Reminisce Active Member Apr 26, 2020 #1 Hello. On my backend I'm using Code: Copy $d=strtotime("now"); To get the current date and time in ticks. On b4a I'm using B4X: Copy 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.
Hello. On my backend I'm using Code: Copy $d=strtotime("now"); To get the current date and time in ticks. On b4a I'm using B4X: Copy 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.
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2020 #2 You should use B4J to build the back end. Everything will be simpler. What is the value of $d? Upvote 0
Reminisce Active Member Apr 27, 2020 #3 Erel said: You should use B4J to build the back end. Everything will be simpler. What is the value of $d? Click to expand... 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
Erel said: You should use B4J to build the back end. Everything will be simpler. What is the value of $d? Click to expand... 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
Reminisce Active Member Apr 27, 2020 #4 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
Log(Datetime.getdayofyear(tickvalue)) as at last night returns 19,which is wrong.. Because yesterday wasn't the 19th day of the year.
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2020 #5 This is unix time ticks. DateUtils has methods to convert this value to B4X ticks. Upvote 0
Reminisce Active Member Apr 27, 2020 #6 Erel said: This is unix time ticks. DateUtils has methods to convert this value to B4X ticks. Click to expand... 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
Erel said: This is unix time ticks. DateUtils has methods to convert this value to B4X ticks. Click to expand... 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.
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2020 #7 Reminisce said: Another question is, I know the getdayofweek will return an integer, how do I convert that integer into the corresponding day of the week Click to expand... You should start a new thread for a new question. Upvote 0
Reminisce said: Another question is, I know the getdayofweek will return an integer, how do I convert that integer into the corresponding day of the week Click to expand... You should start a new thread for a new question.
Reminisce Active Member Apr 27, 2020 #8 I got that last part, I used DateUtils. Thanks, everything is working fine. God bless you @Erel Upvote 0