Get date and time as Unix epoch: Difference between revisions
Jump to navigation
Jump to search
(imported material) |
(No difference)
|
Latest revision as of 20:26, 4 May 2025
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
.