.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "DateTime::Format::ISO8601 3pm" .TH DateTime::Format::ISO8601 3pm "2015-06-05" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" DateTime::Format::ISO8601 \- Parses ISO8601 formats .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& use DateTime::Format::ISO8601; \& \& my $dt = DateTime::Format::ISO8601\->parse_datetime( $str ); \& my $dt = DateTime::Format::ISO8601\->parse_time( $str ); \& \& or \& \& my $iso8601 = DateTime::Format::ISO8601\->new; \& my $dt = $iso8601\->parse_datetime( $str ); \& my $dt = $iso8601\->parse_time( $str ); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Parses almost all \s-1ISO8601\s0 date and time formats. \&\s-1ISO8601\s0 time-intervals will be supported in a later release. .SH "USAGE" .IX Header "USAGE" .SS "Import Parameters" .IX Subsection "Import Parameters" This module accepts no arguments to it's \f(CW\*(C`import\*(C'\fR method. .SS "Methods" .IX Subsection "Methods" \fIConstructors\fR .IX Subsection "Constructors" .IP "\(bu" 4 new( ... ) .Sp Accepts an optional hash. .Sp .Vb 5 \& my $iso8601 = DateTime::Format::ISO8601\->new( \& base_datetime => $dt, \& cut_off_year => 42, \& legacy_year => 1, \& ); .Ve .RS 4 .IP "\(bu" 4 base_datetime .Sp A \f(CW\*(C`DateTime\*(C'\fR object that will be used to fill in missing information from incomplete date/time formats. .Sp This key is optional. .IP "\(bu" 4 cut_off_year .Sp A integer representing the cut-off point between interpreting 2\-digits years as 19xx or 20xx. .Sp .Vb 2 \& 2\-digit years < legacy_year will be interpreted as 20xx \& 2\-digit years >= legacy_year will be untreated as 19xx .Ve .Sp This key defaults to the value of \f(CW\*(C`DefaultCutOffYear\*(C'\fR. .IP "\(bu" 4 legacy_year .Sp A boolean value controlling if a 2\-digit year is interpreted as being in the current century (unless a \f(CW\*(C`base_datetime\*(C'\fR is set) or if \f(CW\*(C`cut_off_year\*(C'\fR should be used to place the year in either 20xx or 19xx. .Sp This key defaults to the value of \f(CW\*(C`DefaultLegacyYear\*(C'\fR. .RE .RS 4 .RE .IP "\(bu" 4 clone .Sp Returns a replica of the given object. .PP \fIObject Methods\fR .IX Subsection "Object Methods" .IP "\(bu" 4 base_datetime .Sp Returns a \f(CW\*(C`DateTime\*(C'\fR object if a \f(CW\*(C`base_datetime\*(C'\fR has been set. .IP "\(bu" 4 set_base_datetime( object => \f(CW$object\fR ) .Sp Accepts a \f(CW\*(C`DateTime\*(C'\fR object that will be used to fill in missing information from incomplete date/time formats. .IP "\(bu" 4 cut_off_year .Sp Returns a integer representing the cut-off point between interpreting 2\-digits years as 19xx or 20xx. .IP "\(bu" 4 set_cut_off_year( \f(CW$int\fR ) .Sp Accepts a integer representing the cut-off point between interpreting 2\-digits years as 19xx or 20xx. .Sp .Vb 2 \& 2\-digit years < legacy_year will be interpreted as 20xx \& 2\-digit years >= legacy_year will be interpreted as 19xx .Ve .IP "\(bu" 4 legacy_year .Sp Returns a boolean value indicating the 2\-digit year handling behavior. .IP "\(bu" 4 set_legacy_year( \f(CW$bool\fR ) .Sp Accepts a boolean value controlling if a 2\-digit year is interpreted as being in the current century (unless a \f(CW\*(C`base_datetime\*(C'\fR is set) or if \&\f(CW\*(C`cut_off_year\*(C'\fR should be used to place the year in either 20xx or 19xx. .PP \fIClass Methods\fR .IX Subsection "Class Methods" .IP "\(bu" 4 DefaultCutOffYear( \f(CW$int\fR ) .Sp Accepts a integer representing the cut-off point for 2\-digit years when calling \f(CW\*(C`parse_*\*(C'\fR as class methods and the default value for \f(CW\*(C`cut_off_year\*(C'\fR when creating objects. If called with no parameters this method will return the default value for \f(CW\*(C`cut_off_year\*(C'\fR. .IP "\(bu" 4 DefaultLegacyYear( \f(CW$bool\fR ) .Sp Accepts a boolean value controlling the legacy year behavior when calling \&\f(CW\*(C`parse_*\*(C'\fR as class methods and the default value for \f(CW\*(C`legacy_year\*(C'\fR when creating objects. If called with no parameters this method will return the default value for \f(CW\*(C`legacy_year\*(C'\fR. .PP \fIParser(s)\fR .IX Subsection "Parser(s)" .PP These may be called as either class or object methods. .IP "\(bu" 4 parse_datetime .IP "\(bu" 4 parse_time .Sp Please see the \*(L"\s-1FORMATS\*(R"\s0 section. .SH "FORMATS" .IX Header "FORMATS" There are 6 string that can match against date only or time only formats. The \f(CW\*(C`parse_datetime\*(C'\fR method will attempt to match these ambiguous strings against date only formats. If you want to match against the time only formats see the \f(CW\*(C`parse_time\*(C'\fR method. .SS "Conventions" .IX Subsection "Conventions" .IP "\(bu" 4 Expanded \s-1ISO8601\s0 .Sp These formats are supported with exactly 6 digits for the year. Support for a variable number of digits will be in a later release. .IP "\(bu" 4 Precision .Sp If a format doesn't include a year all larger time unit up to and including the year are filled in using the current date/time or [if set] the \&\f(CW\*(C`base_datetime\*(C'\fR object. .IP "\(bu" 4 Fractional time .Sp There is no limit on the expressed precision. .SS "Supported via parse_datetime" .IX Subsection "Supported via parse_datetime" The supported formats are listed by the section of \s-1ISO 8601:2000\s0(E) in which they appear. .PP \fI5.2 Dates\fR .IX Subsection "5.2 Dates" .PP \fI5.2.1.1\fR .IX Subsection "5.2.1.1" .PP .Vb 2 \& YYYYMMDD \& YYYY\-MM\-DD .Ve .PP \fI5.2.1.2\fR .IX Subsection "5.2.1.2" .PP .Vb 3 \& YYYY\-MM \& YYYY \& YY .Ve .PP \fI5.2.1.3\fR .IX Subsection "5.2.1.3" .PP .Vb 9 \& YYMMDD \& YY\-MM\-DD \& \-YYMM \& \-YY\-MM \& \-YY \& \-\-MMDD \& \-\-MM\-DD \& \-\-MM \& \-\-\-DD .Ve .PP \fI5.2.1.4\fR .IX Subsection "5.2.1.4" .PP .Vb 5 \& +[YY]YYYYMMDD \& +[YY]YYYY\-MM\-DD \& +[YY]YYYY\-MM \& +[YY]YYYY \& +[YY]YY .Ve .PP \fI5.2.2.1\fR .IX Subsection "5.2.2.1" .PP .Vb 2 \& YYYYDDD \& YYYY\-DDD .Ve .PP \fI5.2.2.2\fR .IX Subsection "5.2.2.2" .PP .Vb 3 \& YYDDD \& YY\-DDD \& \-DDD .Ve .PP \fI5.2.2.3\fR .IX Subsection "5.2.2.3" .PP .Vb 2 \& +[YY]YYYYDDD \& +[YY]YYYY\-DDD .Ve .PP \fI5.3.2.1\fR .IX Subsection "5.3.2.1" .PP .Vb 2 \& YYYYWwwD \& YYYY\-Www\-D .Ve .PP \fI5.2.3.2\fR .IX Subsection "5.2.3.2" .PP .Vb 10 \& YYYYWww \& YYYY\-Www \& YYWwwD \& YY\-Www\-D \& YYWww \& YY\-Www \& \-YWwwD \& \-Y\-Www\-D \& \-YWww \& \-Y\-Www \& \-WwwD \& \-Www\-D \& \-Www \& \-W\-D .Ve .PP \fI5.2.3.4\fR .IX Subsection "5.2.3.4" .PP .Vb 4 \& +[YY]YYYYWwwD \& +[YY]YYYY\-Www\-D \& +[YY]YYYYWww \& +[YY]YYYY\-Www .Ve .PP \fI5.3 Time of Day\fR .IX Subsection "5.3 Time of Day" .PP \fI5.3.1.1 \- 5.3.1.3\fR .IX Subsection "5.3.1.1 - 5.3.1.3" .PP optionally prefixed with 'T' .PP \fI5.3.1.1\fR .IX Subsection "5.3.1.1" .PP .Vb 1 \& hh:mm:ss .Ve .PP \fI5.3.1.2\fR .IX Subsection "5.3.1.2" .PP .Vb 1 \& hh:mm .Ve .PP \fI5.3.1.3 \- 5.3.1.4\fR .IX Subsection "5.3.1.3 - 5.3.1.4" .PP fractional (decimal) separator maybe either ',' or '.' .PP \fI5.3.1.3\fR .IX Subsection "5.3.1.3" .PP .Vb 5 \& hhmmss,ss \& hh:mm:ss,ss \& hhmm,mm \& hh:mm,mm \& hh,hh .Ve .PP \fI5.3.1.4\fR .IX Subsection "5.3.1.4" .PP .Vb 5 \& \-mm:ss \& \-mmss,s \& \-mm:ss,s \& \-mm,m \& \-\-ss,s .Ve .PP \fI5.3.3 \- 5.3.4.2\fR .IX Subsection "5.3.3 - 5.3.4.2" .PP optionally prefixed with 'T' .PP \fI5.3.3\fR .IX Subsection "5.3.3" .PP .Vb 7 \& hhmmssZ \& hh:mm:ssZ \& hhmmZ \& hh:mmZ \& hhZ \& hhmmss.ssZ \& hh:mm:ss.ssZ .Ve .PP \fI5.3.4.2\fR .IX Subsection "5.3.4.2" .PP .Vb 6 \& hhmmss[+\-]hhmm \& hh:mm:ss[+\-]hh:mm \& hhmmss[+\-]hh \& hh:mm:ss[+\-]hh \& hhmmss.ss[+\-]hhmm \& hh:mm:ss.ss[+\-]hh:mm .Ve .PP \fI5.4 Combinations of date and time of day\fR .IX Subsection "5.4 Combinations of date and time of day" .PP \fI5.4.1\fR .IX Subsection "5.4.1" .PP .Vb 8 \& YYYYMMDDThhmmss \& YYYY\-MM\-DDThh:mm:ss \& YYYYMMDDThhmmssZ \& YYYY\-MM\-DDThh:mm:ssZ \& YYYYMMDDThhmmss[+\-]hhmm \& YYYY\-MM\-DDThh:mm:ss[+\-]hh:mm \& YYYYMMDDThhmmss[+\-]hh \& YYYY\-MM\-DDThh:mm:ss[+\-]hh .Ve .PP \fI5.4.2\fR .IX Subsection "5.4.2" .PP .Vb 4 \& YYYYMMDDThhmmss.ss \& YYYY\-MM\-DDThh:mm:ss.ss \& YYYYMMDDThhmmss.ss[+\-]hhmm \& YYYY\-MM\-DDThh:mm:ss.ss[+\-]hh:mm .Ve .PP Support for this section is not complete. .PP .Vb 6 \& YYYYMMDDThhmm \& YYYY\-MM\-DDThh:mm \& YYYYDDDThhmmZ \& YYYY\-DDDThh:mmZ \& YYYYWwwDThhmm[+\-]hhmm \& YYYY\-Www\-DThh:mm[+\-]hh .Ve .PP \fI5.5 Time-Intervals\fR .IX Subsection "5.5 Time-Intervals" .PP Will be supported in a later release. .SS "Supported via parse_time" .IX Subsection "Supported via parse_time" \fI5.3.1.1 \- 5.3.1.3\fR .IX Subsection "5.3.1.1 - 5.3.1.3" .PP optionally prefixed with 'T' .PP \fI5.3.1.1\fR .IX Subsection "5.3.1.1" .PP .Vb 1 \& hhmmss .Ve .PP \fI5.3.1.2\fR .IX Subsection "5.3.1.2" .PP .Vb 2 \& hhmm \& hh .Ve .PP \fI5.3.1.4\fR .IX Subsection "5.3.1.4" .PP .Vb 3 \& \-mmss \& \-mm \& \-\-ss .Ve .SH "STANDARDS DOCUMENT" .IX Header "STANDARDS DOCUMENT" .SS "Title" .IX Subsection "Title" .Vb 4 \& ISO8601:2000(E) \& Data elements and interchange formats \- information exchange \- \& Representation of dates and times \& Second edition 2000\-12\-15 .Ve .SS "Reference Number" .IX Subsection "Reference Number" .Vb 1 \& ISO/TC 154 N 362 .Ve .SH "CREDITS" .IX Header "CREDITS" Iain 'Spoon' Truskett (\s-1SPOON\s0) who wrote DateTime::Format::Builder. That has grown into \fIThe Vacuum Energy Powered \f(CI\*(C`Swiss Army\*(C'\fI Katana\fR of date and time parsing. This module was inspired by and conceived in honor of Iain's work. .PP Tom Phoenix (\s-1PHOENIX\s0) and \s-1PDX\s0.pm for helping me solve the \s-1ISO\s0 week conversion bug. Not by fixing the code but motivation me to fix it so I could participate in a game of \f(CW\*(C`Zendo\*(C'\fR. .PP Jonathan Leffler (\s-1JOHNL\s0) for reporting a test bug. .PP Kelly McCauley for a patch to add 8 missing formats. .PP Alasdair Allan (\s-1AALLAN\s0) for complaining about excessive test execution time. .PP Everyone at the DateTime \f(CW\*(C`Asylum\*(C'\fR. .SH "SUPPORT" .IX Header "SUPPORT" Support for this module is provided via the email list. See for more details. .SH "AUTHOR" .IX Header "AUTHOR" Joshua Hoblitt .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2003\-2005 Joshua Hoblitt. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the licenses can be found in the \fI\s-1LICENSE\s0\fR file included with this module, or in perlartistic and perlgpl as supplied with Perl 5.8.1 and later. .SH "SEE ALSO" .IX Header "SEE ALSO" DateTime, DateTime::Format::Builder,