DateTi...:DotNet(3pm)
π NAME π
okay so bestie, welcome to DateTime::Format::Epoch::DotNet β she's the little Perl module from the User Contributed Perl Documentation section (that's the 3pm manual, iykyk) whose whole entire job is converting DateTimes to and from .NET epoch seconds. that's it. that's the gig. and she does it flawlessly. π
β¨ SYNOPSIS β¨
the group chat demo, verbatim, no cap:
use DateTime::Format::Epoch::DotNet;
my $dt = DateTime::Format::Epoch::DotNet->parse_datetime( 1051488000 );
DateTime::Format::Epoch::DotNet->format_datetime($dt);
# 1051488000
my $formatter = DateTime::Format::Epoch::DotNet->new();
my $dt2 = $formatter->parse_datetime( 1051488000 );
$formatter->format_datetime($dt2);
like. look at her go. class method call, object method call, same vibe, same energy. π¦
πΈ DESCRIPTION πΈ
so this module takes a DateTime object β or literally any object that can be converted into a DateTime object, she's not picky, she's welcoming β and turns it into the number of seconds since the epoch defined in the .NET Framework SDK. and vice versa. both directions. she's bidirectional and she's thriving. π₯
π IMPORTANT CAVEAT, FR FR, DO NOT SKIM THIS PART: that epoch is defined in the local time zone. this is not a drill.
what that means in practice? these two chunks of code print the same number of seconds, even though the two datetimes they describe are literally 6 hours apart. yes. six. hours. it's giving "time zones are a social construct" but make it a spec decision:
$dt = DateTime->new( year => 2003, month => 5, day => 2,
time_zone => 'Europe/Amsterdam' );
print $formatter->format_datetime($dt);
$dt = DateTime->new( year => 2003, month => 5, day => 2,
time_zone => 'America/Chicago' );
print $formatter->format_datetime($dt);
Amsterdam and Chicago, same output. iconic behaviour. slightly unhinged behaviour. both. π«Ά
π METHODS π
most of the methods are the exact same ones hanging out in DateTime::Format::Epoch β she's literally borrowing the whole wardrobe. the one and only difference is the constructor. that's the plot twist. that's the whole plot.
new()β the constructor for the formatter/parser object. she takes no parameters. zero. none. don't try to hand her anything, she will simply not accept it. π
π SUPPORT π
need a hand? support for this module comes through the datetime@perl.org email list. more deets live over at http://lists.perl.org/. go say hi, they're nice. π§
π AUTHOR π
Eugene van der Pijll <pijll@gmx.net> β legend, icon, wrote this in 2003 and it still slays. β
π COPYRIGHT π
Copyright (c) 2003 Eugene van der Pijll. All rights reserved. this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. so like, go off, just be cool about it. πΈ
π¦ SEE ALSO π¦
DateTimeβ the main character, obviouslydatetime@perl.orgmailing list
and that's the whole page bestie!! this little gem ships with perl v5.34.0, dated 2022-06-13, and it lives in the DateTi...:DotNet(3pm) corner of your friendly neighbourhood User Contributed Perl Documentation. mwah. π
β¨π
π¦ 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