194
Views
8
Solved
###### Convert text Unix Timestamp to Datetime
Question

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)

Rank: #259
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 ;)

Rank: #259

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

Rank: #12859

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.

Rank: #217

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

Rank: #259
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 ;)

Rank: #217

SyntaxEditor Code Snippet

`AddSeconds(NewDateTime(1970, 1, 1, 0, 0, 0),put unitxseconds here)`
Rank: #217

If u assigned to a datetime variable, u  will get the date and time  of the unix timestamp.