.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" 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 .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . 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 >0, 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 .\" ======================================================================== .\" .IX Title "DateTime::Format::RFC3339 3pm" .TH DateTime::Format::RFC3339 3pm 2024-01-27 "perl v5.38.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::RFC3339 \- Parse and format RFC3339 datetime strings .SH VERSION .IX Header "VERSION" Version 1.8.0 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use DateTime::Format::RFC3339; \& \& my $format = DateTime::Format::RFC3339\->new(); \& my $dt = $format\->parse_datetime( \*(Aq2002\-07\-01T13:50:05Z\*(Aq ); \& \& # 2002\-07\-01T13:50:05Z \& say $format\->format_datetime( $dt ); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module understands the RFC3339 date/time format, an ISO 8601 profile, defined at . .PP It can be used to parse these formats in order to create the appropriate objects. .SH CONSTRUCTOR .IX Header "CONSTRUCTOR" .SS new .IX Subsection "new" .Vb 2 \& my $format = DateTime::Format::RFC3339\->new(); \& my $format = DateTime::Format::RFC3339\->new( %options ); .Ve .PP A number of options are supported: .IP \(bu 4 decimals .Sp .Vb 2 \& decimals => undef [default] \& decimals => $decimals .Ve .Sp Date-time strings generated by will have this many decimals (an integer from zero to nine). If \f(CW\*(C`undef\*(C'\fR, zero will be used if the date-time has no decimals, nine otherwise. .IP \(bu 4 sep .Sp .Vb 2 \& sep => "T" [default] \& sep => $sep .Ve .IP \(bu 4 sep_re .Sp .Vb 1 \& sep_re => $sep_re .Ve .Sp The spec allows for a separator other than "\f(CW\*(C`T\*(C'\fR" to be used between the date and the time. .Sp The string provided to the \f(CW\*(C`sep\*(C'\fR option is used when formatting date-time objects into strings, and the regex pattern provided to the \f(CW\*(C`sep_re\*(C'\fR option is used when parsing strings into date-time objects. .Sp The default for \f(CW\*(C`sep_re\*(C'\fR is a regex pattern that matches the separator (which is "\f(CW\*(C`T\*(C'\fR" by default). .IP \(bu 4 uc_only .Sp .Vb 2 \& uc_only => 0 [default] \& uc_only => 1 .Ve .Sp Only an uppercase date and time separator and an uppercase timezone offset "Z" will be accepted by \f(CW\*(C`parse_datetime\*(C'\fR when this option is true. .SH METHODS .IX Header "METHODS" .SS parse_datetime .IX Subsection "parse_datetime" .Vb 2 \& my $dt = DateTime::Format::RFC3339\->parse_datetime( $string ); \& my $dt = $format\->parse_datetime( $string ); .Ve .PP Given a RFC3339 datetime string, this method will return a new DateTime object. .PP If given an improperly formatted string, this method will croak. .PP For a more flexible parser, see DateTime::Format::ISO8601. .SS format_datetime .IX Subsection "format_datetime" .Vb 2 \& my $string = DateTime::Format::RFC3339\->format_datetime( $dt ); \& my $string = $format\->format_datetime( $dt ); .Ve .PP Given a DateTime object, this methods returns a RFC3339 datetime string. .SH "SEE ALSO" .IX Header "SEE ALSO" .IP \(bu 4 DateTime .IP \(bu 4 DateTime::Format::ISO8601 .IP \(bu 4 , "Date and Time on the Internet: Timestamps" .SH "DOCUMENTATION AND SUPPORT" .IX Header "DOCUMENTATION AND SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc DateTime::Format::RFC3339 .Ve .PP You can also find it online at this location: .IP \(bu 4 .PP If you need help, the following are great resources: .IP \(bu 4 .IP \(bu 4 .IP \(bu 4 You may also contact the author directly. .SH BUGS .IX Header "BUGS" Please report any bugs or feature requests using . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH REPOSITORY .IX Header "REPOSITORY" .IP \(bu 4 Web: .IP \(bu 4 git: .SH AUTHOR .IX Header "AUTHOR" Eric Brine, \f(CW\*(C`\*(C'\fR .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" No rights reserved. .PP The author has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law. .PP Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.