Skip to content

Get date and time as Unix epoch

Dr. Nicola Mingotti edited this page Dec 11, 2021 · 1 revision

Problem. You want the current date and time as a Unix epoch. That is, roughly speaking, as number of seconds since 01-Jan-1970.

Solution.

DateAndTime now unixTimeSeconds .    "=> 1629056092 "

Exercise. Get the same number running the Linux date command as an external program.
Exercise. Read the method DateAndTime#unitTimeSeconds.


NM on 15-Aug-2021. Tested in Cuis5.0-4738.image

Clone this wiki locally