- SEE ALSO
- COPYRIGHT AND LICENSE
Time::Moment::Epoch - Convert various epoch times to Time::Moment times.
Convert various epoch times to and from datetimes using Time::Moment.
use Time::Moment::Epoch; say Time::Moment::Epoch::unix(1234567890); # 2009-02-13T23:31:30Z say Time::Moment::Epoch::to_unix('2009-02-13T23:31:30Z'); # 1234567890 say Time::Moment::Epoch::chrome(12879041490654321); # 2009-02-13T23:31:30.654321Z say Time::Moment::Epoch::to_chrome('2009-02-13T23:31:30.654321Z'); # 12879041490654321
The following functions convert an epoch of the specified type to a Time::Moment object.
They each have a corresponding
to_$type function which accepts a datetime string (in any format accepted by the
from_string method of Time::Moment) and returns the corresponding epoch.
APFS time is the number of nanoseconds since the Unix epoch. Cf., APFS filesystem format (https://blog.cugu.eu/post/apfs/).
Chrome time is the number of microseconds since 1601-01-01.
Cocoa time is the number of seconds since 2001-01-01.
DOS time stores dates since 1980-01-01 in bitfields.
Google Calendar time is 32-day months from the day before the Unix epoch.
ICQ time is the number of days (with an allowed fractional part) since 1899-12-30.
Java time is the number of milliseconds since the Unix epoch.
Mozilla time is the number of microseconds since the Unix epoch.
OLE time is the number of days since 1899-12-30, packed as a double-precision float in native format.
Symbian time is the number of microseconds since the year 0.
Unix time is the number of seconds since 1970-01-01.
UUID version 1 time (RFC 4122) is the number of hectonanoseconds (100 ns) since 1582-10-15.
Windows date time (e.g., .NET) is the number of hectonanoseconds (100 ns) since 0001-01-01.
Windows file time (e.g., NTFS) is the number of hectonanoseconds (100 ns) since 1601-01-01.
Windows system time is a sixteen byte representation of Windows file time. It's in eight sixteen-bit segments...sort of like a ctime.
year 1601..30827 month 1..12 (January..December) day_of_week 0..6 (Sunday..Saturday) day 1..31 hour 0..23 minute 0..59 second 0..59 milliseconds 0..999
Note that Time::Moment day_of_week is one-based and starts on Monday (so Sunday is 7 instead of 0).
Tim Heaney <email@example.com>
Mary Ehlers <firstname.lastname@example.org>
This software is copyright (c) 2017 by Tim Heaney.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.