Dave Rolsky > DateTime-Format-Strptime-1.52 > DateTime::Format::Strptime

Download:
DateTime-Format-Strptime-1.52.tar.gz

Dependencies

Annotate this POD (2)

Related Modules

Date::Manip
Time::Local
Date::Calc
Date::Parse
Date::Format
Date::Language
Time::ParseDate
Data::Dumper
Time::Fuzzy
Date::Time
more...
By perlmonks.org

CPAN RT

New  3
Open  3
Stalled  1
View/Report Bugs
Module Version: 1.52   Source   Latest Release: DateTime-Format-Strptime-1.55

NAME ^

DateTime::Format::Strptime - Parse and format strp and strf time patterns

VERSION ^

version 1.52

SYNOPSIS ^

    use DateTime::Format::Strptime;

    my $strp = DateTime::Format::Strptime->new(
        pattern   => '%T',
        locale    => 'en_AU',
        time_zone => 'Australia/Melbourne',
    );

    my $dt = $strp->parse_datetime('23:16:42');

    $strp->format_datetime($dt);

    # 23:16:42

    # Croak when things go wrong:
    my $strp = DateTime::Format::Strptime->new(
        pattern   => '%T',
        locale    => 'en_AU',
        time_zone => 'Australia/Melbourne',
        on_error  => 'croak',
    );

    $newpattern = $strp->pattern('%Q');

    # Unidentified token in pattern: %Q in %Q at line 34 of script.pl

    # Do something else when things go wrong:
    my $strp = DateTime::Format::Strptime->new(
        pattern   => '%T',
        locale    => 'en_AU',
        time_zone => 'Australia/Melbourne',
        on_error  => \&phone_police,
    );

DESCRIPTION ^

This module implements most of strptime(3), the POSIX function that is the reverse of strftime(3), for DateTime. While strftime takes a DateTime and a pattern and returns a string, strptime takes a string and a pattern and returns the DateTime object associated.

CONSTRUCTOR ^

METHODS ^

This class offers the following methods.

EXPORTS ^

There are no methods exported by default, however the following are available:

STRPTIME PATTERN TOKENS ^

The following tokens are allowed in the pattern string for strptime (parse_datetime):

AUTHOR EMERITUS ^

This module was created by Rick Measham.

BUGS ^

Please report any bugs or feature requests to bug-datetime-format-strptime@rt.cpan.org, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SEE ALSO ^

datetime@perl.org mailing list.

http://datetime.perl.org/

perl, DateTime, DateTime::TimeZone, DateTime::Locale

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is Copyright (c) 2010 by Dave Rolsky.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
syntax highlighting: