install tutorials examples
documentation license about
12.1.0 released on Sep 19, 2022
get-time to [ define ] <time var> \ [ timezone <tz> ] \ [ year <year> ] \ [ month <month> ] \ [ day <day> ] \ [ hour <hour> ] \ [ minute <minute> ] \ [ second <second> ] \ [ format <format> ]
So for example to get the time in Phoenix, Arizona you could use "America/Phoenix" for <tz>. If timezone clause is omitted, then time is produced in "GMT" timezone by default. DST (Daylight Savings Time) is automatically adjusted.
<format> allows you to get the time in any string format you like, using the specifiers available in C "strftime". For example, if <format> is "%A, %B %d %Y, %l:%M %p %Z", it will produce something like "Sunday, November 28 2021, 9:07 PM MST". The default format is "UTC/GMT" format, which for instance, is suitable for use with cookie timestamps, and looks something like "Mon, 16 Jul 2012 00:03:01 GMT".
get-time to time_var year 2 day -5 hour -1
To get the time in the same format, only 1 year and 2 months in the future:
get-time to define mytime
An example of a future date (1 year, 3 months, 4 days, 7 hours, 15 minutes and 22 seconds into the future), in a specific format (see "strftime"):
get-time to define mytime year 1 month 2
get-time to time_var timezone "MST" year 1 month 3 day 4 hour 7 minute 15 second 22 format "%A, %B %d %Y, %l:%M %p %Z"