1DateTime::Format::EpochU:s:eDrotCNoentt(r3i)buted Perl DDoactuemTeinmtea:t:iFoonrmat::Epoch::DotNet(3)
2
3
4
6 DateTime::Format::Epoch::DotNet - Convert DateTimes to/from .NET epoch
7 seconds
8
10 use DateTime::Format::Epoch::DotNet;
11
12 my $dt = DateTime::Format::Epoch::DotNet->parse_datetime( 1051488000 );
13
14 DateTime::Format::Epoch::DotNet->format_datetime($dt);
15 # 1051488000
16
17 my $formatter = DateTime::Format::Epoch::DotNet->new();
18 my $dt2 = $formatter->parse_datetime( 1051488000 );
19 $formatter->format_datetime($dt2);
20
22 This module can convert a DateTime object (or any object that can be
23 converted to a DateTime object) to the number of seconds since the
24 epoch defined in the .NET Framework SDK.
25
26 Note that this epoch is defined in the local time zone. This means that
27 these two pieces of code will print the same number of seconds, even
28 though they represent two datetimes 6 hours apart:
29
30 $dt = DateTime->new( year => 2003, month => 5, day => 2,
31 time_zone => 'Europe/Amsterdam' );
32 print $formatter->format_datetime($dt);
33
34 $dt = DateTime->new( year => 2003, month => 5, day => 2,
35 time_zone => 'America/Chicago' );
36 print $formatter->format_datetime($dt);
37
39 Most of the methods are the same as those in DateTime::Format::Epoch.
40 The only difference is the constructor.
41
42 • new()
43
44 Constructor of the formatter/parser object. It has no parameters.
45
47 Support for this module is provided via the datetime@perl.org email
48 list. See http://lists.perl.org/ for more details.
49
51 Eugene van der Pijll <pijll@gmx.net>
52
54 Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This
55 program is free software; you can redistribute it and/or modify it
56 under the same terms as Perl itself.
57
59 DateTime
60
61 datetime@perl.org mailing list
62
63
64
65perl v5.34.0 2021-07-22DateTime::Format::Epoch::DotNet(3)