DateTi...h::NTP(3pm)
π NAME π
ok so DateTime::Format::Epoch::NTP β it converts DateTimes to and from NTP epoch seconds, bestie. that's the whole job. and it does it flawlessly. periodt.
β¨ SYNOPSIS β¨
here's the vibe, in code:
use DateTime::Format::Epoch::NTP;
my $dt = DateTime::Format::Epoch::NTP->parse_datetime( 3629861151 );
print $dt->datetime; # '2015-01-10T06:45:51'
my $formatter = DateTime::Format::Epoch::NTP->new();
my $dt = DateTime->new( year => 2015, month => 1, day => 10,
time_zone => 'Europe/Amsterdam' );
print $formatter->format_datetime($dt); # '3629833200'
like. look at it. parse a number, get a whole datetime back. format a datetime, get a number back. it's giving effortless. π
π¦ DESCRIPTION π¦
this module takes a DateTime object β or honestly any object that can be converted into a DateTime object, we don't gatekeep β and turns it into the number of seconds since the NTP epoch. and it goes the other way too, obviously. π₯
π¨ important lore: the NTP epoch uses UTC. so if you parse an NTP date, your DateTime object is gonna be sitting in the UTC timezone. no cap. don't be surprised. π
π METHODS π
ngl most of the methods here are literally the same as the ones in DateTime::Format::Epoch. the only difference is the constructor. that's it. that's the tea. π
new()β the constructor of the formatter/parser object. it takes no parameters. zero. none. it just exists and slays. β¨
π«Ά SUPPORT π«Ά
need help? support for this module comes through the datetime@perl.org email list. more deets over at http://lists.perl.org/. go ask, they're nice. π
π AUTHOR π
Eugene van der Pijll <pijll@gmx.net> β icon, legend, the moment. π
π COPYRIGHT π
Copyright (c) 2015 Michiel Beijen. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so yes, you may. go forth. π§
πΈ SEE ALSO πΈ
DateTime- the
datetime@perl.orgmailing list
ok bestie that's the whole page, you ate it, go convert some epochs π
this was perl v5.34.0, dated 2022-06-13, and it lives in the DateTi...h::NTP manpage β mwah, take care of her πβ¨π¦
π¦ where this page comes from
- debian bookworm: libdatetime-format-epoch-perl 0.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdatetime-format-epoch-perl 0.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdatetime-format-epoch-perl 0.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdatetime-format-epoch-perl 0.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdatetime-format-epoch-perl 0.16-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms