Android Question How to correctly parse ticks from PHP strtotime function.

Reminisce

Active Member
Hello.
On my backend I'm using
PHP code:
$d=strtotime("now");
To get the current date and time in ticks.
On b4a I'm using
B4X:
Log(Datetime.getdayofyear(tickvalue))
This is returning the wrong date, month and year. I'm using xamp for my local server, and the php code echoes the correct date and time.

I think b4a doesn't understand this tick value.
 

Reminisce

Active Member
You should use B4J to build the back end. Everything will be simpler.

What is the value of $d?
I appreciate your advice, the project requirement is php to be used as the backend..


$d = 1587970235
$d should return the current data and time.
$d is tick value I passed to b4a and it failed to parse it correctly. If I use an online tick to date converter, I get the correct date and time. For the above value, 1587970235 is the same thing as 4/27/2020, 7:50:35 AM
 
Upvote 0

Reminisce

Active Member
Log(Datetime.getdayofyear(tickvalue)) as at last night returns 19,which is wrong.. Because yesterday wasn't the 19th day of the year.
 
Upvote 0

Reminisce

Active Member
This is unix time ticks. DateUtils has methods to convert this value to B4X ticks.
Okay, great.. I'll check, so I presume after converting, it should returned the correct date and time. Another question is, I know the getdayofweek will return an integer, how do I convert that integer into the corresponding day of the week?
For example, i want to convert 1 to Monday, I don't want to wrote a separate sub for that.
 
Upvote 0
Top