1DateTime::Format::EpochU:s:eMracCOoSn(t3r)ibuted Perl DoDcautmeeTnitmaet:i:oFnormat::Epoch::MacOS(3)
2
3
4
6 DateTime::Format::Epoch::MacOS - Convert DateTimes to/from Mac OS epoch
7 seconds
8
10 use DateTime::Format::Epoch::MacOS;
11
12 my $dt = DateTime::Format::Epoch::MacOS->parse_datetime( 1051488000 );
13 DateTime::Format::Epoch::MacOS->format_datetime($dt);
14 # 1051488000
15
16 my $formatter = DateTime::Format::Epoch::MacOS->new();
17
18 my $dt2 = $formatter->parse_datetime( 1051488000 );
19
20 $formatter->format_datetime($dt2);
21 # 1051488000
22
24 This module can convert a DateTime object (or any object that can be
25 converted to a DateTime object) to the number of seconds since the Mac
26 OS epoch.
27
28 Note that the Mac OS epoch is defined in the local time zone. This
29 means that these two pieces of code will print the same number of
30 seconds, even though they represent two datetimes 6 hours apart:
31
32 $dt = DateTime->new( year => 2003, month => 5, day => 2,
33 time_zone => 'Europe/Amsterdam' );
34 print $formatter->format_datetime($dt);
35
36 $dt = DateTime->new( year => 2003, month => 5, day => 2,
37 time_zone => 'America/Chicago' );
38 print $formatter->format_datetime($dt);
39
40 Mac OS X is a Unix system, and uses the Unix epoch
41 (1970-01-01T00:00:00). Use DateTime::Format::Epoch::Unix instead.
42
44 Most of the methods are the same as those in DateTime::Format::Epoch.
45 The only difference is the constructor.
46
47 ยท new()
48
49 Constructor of the formatter/parser object. It has no parameters.
50
52 Support for this module is provided via the datetime@perl.org email
53 list. See http://lists.perl.org/ for more details.
54
56 Eugene van der Pijll <pijll@gmx.net>
57
59 Copyright (c) 2003 Eugene van der Pijll. All rights reserved. This
60 program is free software; you can redistribute it and/or modify it
61 under the same terms as Perl itself.
62
64 DateTime
65
66 datetime@perl.org mailing list
67
68
69
70perl v5.28.1 2019-02-02 DateTime::Format::Epoch::MacOS(3)