In DateTime§

See primary documentation in context for method posix

method posix(Bool:D: $ignore-timezone = False --> Int:D)

Returns the date and time as a POSIX/UNIX timestamp (integral seconds since the POSIX epoch, 1970-01-01T00:00:00Z).

If $ignore-timezone is True, the DateTime object will be treated as if the time zone offset is zero.

method posix(Bool:D: $ignore-timezone = False:$real --> Num:D)

As of release 2022.06 of the Rakudo compiler, it is also possible to specify a :real named argument. If specified with a true value, a Num will be returned, allowing for sub-second accuracy of the number of seconds since the POSIX epoch.

say DateTime.new('2015-12-24T12:23:00Z').posix;           # OUTPUT: «1450959780␤» 
say DateTime.new('2022-06-21T12:23:00.5Z').posix;         # OUTPUT: «1655814180␤» 
say DateTime.new('2022-06-21T12:23:00.5Z').posix(:real);  # OUTPUT: «1655814180.5␤»