1DateTime::Format::W3CDTUFs(e3r)Contributed Perl DocumentDaattieoTnime::Format::W3CDTF(3)
2
3
4
6 DateTime::Format::W3CDTF - Parse and format W3CDTF datetime strings
7
9 This document describes DateTime::Format::W3CDTF version 0.08
10
12 use DateTime::Format::W3CDTF;
13
14 my $w3c = DateTime::Format::W3CDTF->new(strict => 1);
15 my $dt = $w3c->parse_datetime( '2003-02-15T13:50:05-05:00' );
16
17 # 2003-02-15T13:50:05-05:00
18 $w3c->format_datetime($dt);
19
21 This module understands the W3CDTF date/time format, an ISO 8601
22 profile, defined at http://www.w3.org/TR/NOTE-datetime. This format as
23 the native date format of RSS 1.0.
24
25 It can be used to parse these formats in order to create the
26 appropriate objects.
27
29 This API is currently experimental and may change in the future.
30
31 • new()
32
33 Returns a new W3CDTF parser object. Accepts a single "strict"
34 option:
35
36 DateTime::Format::W3CDTF->new(strict => 1);
37
38 If true, parse_datetime() and format_datetime() will only accept
39 and return strings in W3CDTF format, respectively. In particular,
40 the W3CDTF format requires all time components to have timezones.
41
42 If false, timezones are optional.
43
44 • parse_datetime($string)
45
46 Given a W3CDTF datetime string, this method will return a new
47 "DateTime" object.
48
49 If given an improperly formatted string, this method may die.
50
51 • format_datetime($datetime)
52
53 Given a "DateTime" object, this methods returns a W3CDTF datetime
54 string.
55
56 NOTE: As of version 0.4, format_datetime no longer attempts to
57 truncate datetimes without a time component. This is due to the
58 fact that "DateTime" doesn't distinguish between a date with no
59 time component, and midnight.
60
61 • format_date($datetime)
62
63 Given a "DateTime" object, return a W3CDTF datetime string without
64 the time component.
65
67 Support for this module is provided via the datetime@perl.org email
68 list. See http://datetime.perl.org/?MailingList for details.
69
70 Please submit bugs to the CPAN RT system at
71 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime-format-w3cdtf
72 or via email at bug-datetime-format-w3cdtf@rt.cpan.org.
73
75 Dave Rolsky <autarch@urth.org>
76
78 This module is maintained by Gregory Todd Williams
79 <gwilliams@cpan.org>. It was originally created by Kellan Elliott-
80 McCrea <kellan@protest.net>.
81
82 This module was inspired by DateTime::Format::ICal
83
85 Copyright (c) 2009 David Rolsky. All rights reserved. This program is
86 free software; you can redistribute it and/or modify it under the same
87 terms as Perl itself.
88
89 Copyright (c) 2003 Kellan Elliott-McCrea
90
91 Portions of the code in this distribution are derived from other works.
92 Please see the CREDITS file for more details.
93
94 The full text of the license can be found in the LICENSE file included
95 with this module.
96
98 datetime@perl.org mailing list
99
100 http://datetime.perl.org/
101
102
103
104perl v5.34.0 2022-01-21 DateTime::Format::W3CDTF(3)