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.

convert time and date from sec


kokihualpa Feb 25, 2020 03:59 PM

Dear

One equip send me the date and time in seconds since 70/1/1 (format "yy/mm/dd").

I want to convert in format "yy/mm/dd hh:mm:ss".

Is there some way to get it? with the Crbasic language from CR1000?


JDavis Feb 25, 2020 04:08 PM

The CR1000 uses a time format of seconds since 90/1/1. If you take your time, and subtract the seconds between 1990 and 1970, you will have seconds since 1990. You can then use the SecsSince1990() instruction to get a date string.

There is not an option for the particular date format you want, so you will need to use string functions to pull pieces out of the date string and rearrange them. You will use the MID() and & functions.


kokihualpa Feb 25, 2020 05:23 PM

but SecsSince1990() convert a date in seconds. I need the reverse one. Convert date from seconds.


JDavis Feb 26, 2020 03:13 PM

That same instruction can be used both ways. If you use a source of type Long and a destination of type String, it will convert seconds to a date string.

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