Convert text Unix Timestamp to Datetime in the following way.
but There is a problem with the converted datetime unit of seconds. Do you know what the problem is?
thank you very much.
AddSeconds(NewDateTime(1970, 1, 1, 0, 0, 0), TextToLongInteger(UnixTimestamp) / 1000)
Is the difference between the 2 timestamps always 1 second?
Perhaps the fix is to always add 1 second to the formula?
Not sure if this is a bug in the formula. You need Edouardo or Daniel for that analysis ;)
Stefano Valente wrote:
Hi everyone,
I think that the one second less is not a bug but a consequence of the first second in time. The system is considering that 1970-01-01 00:00:00 is the timestamp 1 (probably there is no timestamp 0, just guessing). So, the number of seconds is always less one.
The Addseconds expect an integer, not a long integer. I don't think that is your problem though, but it will be soon.
What is the error you get?
edit:
I tried it and i get no error.
I do have questions:
-UnixTimestamp is in seconds. Why would you "/1000" ?
-You are aware of the fact there is a limit? (January 19, 2038 is the max date).
thank you for your answer
UnixTimestamp is 2019/09/11 17:31:10
but after conversion ,it becomes 2019/09/11 17:31:09
secord is different.. so i think there are someting wrong with the formula.
hi,
this is the solution:
SyntaxEditor Code Snippet
AddSeconds(NewDateTime(1970, 1, 1, 0, 0, 0), DiffSeconds(NewDateTime(1970, 1, 1, 0, 0, 0),TextToDateTime("2019/09/11 17:31:10")) )
regards
Financial Freedom wrote:
if 2019/09/11 17:31:10 is unixTimestamp...how to write it?
best regards
AddSeconds(NewDateTime(1970, 1, 1, 0, 0, 0),put unitxseconds here)
If u assigned to a datetime variable, u will get the date and time of the unix timestamp.