Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.


Log in or register to post/reply in the forum.

Epoch time to normal Date/Time format


Thein Dec 24, 2021 12:34 PM

Hi,

I unterstand that datalogger data timestamp can be easily converted to epoch time in CR Basic. Vice visa, is there any way to convert with CR Basic code from epoch time to normal date/time format? For example "1640348700" to "Friday, 24 December 2021 12:25:00".

Also how to change epoch time in sec to msec, because when I multiply with 1000 it become NAN.

Thanks in adavance.

Best regards,
Thein


JDavis Jan 3, 2022 09:29 PM

The SecsSince1990() instruction works in both directions. You can provide seconds in a variable of type Long, and receive a string. I think format option 2 is what you want.

A Long cannot contain enough digits to hold the milliseconds. In its binary data tables, the datalogger keeps the fractional seconds is a second 4 byte value.


Thein Jan 7, 2022 07:04 PM

Hi JDavis,

Thanks a lot. I'll try it out.

Log in or register to post/reply in the forum.