The now routine

Combined from primary sources listed below.

In Terms ( Language/terms )§

See primary docmentation in context for term now.

term now§

Returns an Instant object representing the current time. It includes leap seconds and as such is a few dozen seconds larger than time:

say (now - time).Int# OUTPUT: «37␤»

In class DateTime ( Type/DateTime )§

See primary docmentation in context for method now.

method now§

method now(:$timezone = $*TZ, :&formatter --> DateTime:D)

Creates a new DateTime object from the current system time. A custom formatter and timezone can be provided. The :$timezone is the offset in seconds from GMT and defaults to the value of $*TZ variable.

say DateTime.now# OUTPUT: «2018-01-08T13:05:32.703292-06:00␤»

Note that one may use the methods shown below chained to the .now to easily express current values, e.g.,

say DateTime.now.year# OUTPUT: «2018␤»