Convert text Unix Timestamp to Datetime

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)






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:

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

thank you for your answer

if 2019/09/11 17:31:10 is unixTimestamp...how to write it?


best regards


Solution

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 ;)

Solution

SyntaxEditor Code Snippet

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.