Rope Language Reference - 'localtime', 'gmtime'

For a tutorial-style description of Rope's time and date handling features, see: TimeAndDate.

This action takes a time value (as returned by $kernel_time, $packet_time) and transforms it into it's components of seconds, minutes, hours, days, months, years - etc. The action returns a single binary string which is not intended to be interpreted directly, but by using the actions tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year and/or tm_wday.

The gmtime action converts the time argument to broken-down time representation, expressed in Coordinated Universal Time (UTC).

The localtime action converts the time to broken-down time representation, expressed relative to the system's configured time zone.

Here's an example that prints the current time..

$kernel_time localtime $t put
println($t tm_hour ":" $t tm_min ":" $t tm_sec)

Here's an example that returns yes if it is run between 9am and 6pm.

$kernel_time localtime $t put
$t tm_hour 9 ge
$t tm_hour 18 lt
   and assert

Revision History

These actions were added to the code on Feb 14th, 2005 - and are therefore not available in versions released before that date.

See Also

TimeAndDate, $kernel_time, $packet_time, tm_sec, tm_min, tm_hour, tm_mday, tm_mon, tm_year, tm_wday