1009
Views
8
Comments
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)






2020-09-01 10-42-42
Stefano Valente
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 ;)

2025-11-24 16-53-49
Tiago Rodrigues
 
MVP

Stefano Valente wrote:

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

 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.

 

2020-09-01 10-42-42
Stefano Valente

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


UserImage.jpg
le le

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.




2025-01-09 14-56-57
IQ78

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

UserImage.jpg
le le

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


2020-09-01 10-42-42
Stefano Valente
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 ;)

2025-11-24 16-53-49
Tiago Rodrigues
 
MVP

Stefano Valente wrote:

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

 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.

 

2025-01-09 14-56-57
IQ78

SyntaxEditor Code Snippet

AddSeconds(NewDateTime(1970, 1, 1, 0, 0, 0),put unitxseconds here)
2025-01-09 14-56-57
IQ78

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

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.