Time::Strptime::Format - strptime(3) format compiler and parser.
use Time::Strptime::Format; # OO style my $fmt = Time::Strptime::Format->new('%Y-%m-%d %H:%M:%S'); my ($epoch_o, $offset_o) = $fmt->parse('2014-01-01 00:00:00');
This is Time::Strptime engine.
This class offers the following methods.
This methods creates a new format object. It accepts the following arguments:
time_zone
The default time zone to use for objects returned from parsing.
locale
The locale to use for objects returned from parsing.
Given a string in the pattern specified in the constructor, this method will return the epoch and offset. If given a string that doesn't match the pattern, the formatter will throw the error.
The following tokens are allowed in the pattern string for strptime:
%%
The % character.
%a or %A
The weekday name according to the current locale, in abbreviated form or the full name. (ignored)
%b or %B or %h
The month name according to the current locale, in abbreviated form or the full name.
%d or %e
The day of month (01-31). This will parse single digit numbers as well.
%D
Equivalent to %m/%d/%y. (This is the American style date, very confusing to non-Americans, especially since %d/%m/%y is widely used in Europe. The ISO 8601 standard pattern is %F.)
%F
Equivalent to %Y-%m-%d. (This is the ISO style date)
%H
The hour (00-23). This will parse single digit numbers as well.
%I
The hour on a 12-hour clock (1-12).
%j
The day number in the year (1-366).
%m
The month number (01-12). This will parse single digit numbers as well.
%M
The minute (00-59). This will parse single digit numbers as well.
%n
Arbitrary white-space. (ignored)
%p
The equivalent of AM or PM according to the locale in use. (See DateTime::Locale)
%r
Equivalent to %I:%M:%S %p.
%R
Equivalent to %H:%M.
%s
Number of seconds since the Epoch.
%S
The second (0-60; 60 may occur for leap seconds.).
%t
Tab space. (ignored)
%T
Equivalent to %H:%M:%S.
%Y
A 4-digit year, including century (for example, 1991).
%z
An RFC-822/ISO 8601 standard time zone specification. (e.g. +1100)
%Z
The time zone name. (e.g. EST)
Copyright (C) karupanerura.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
karupanerura <karupa@cpan.org>
To install Time::Strptime, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Time::Strptime
CPAN shell
perl -MCPAN -e shell install Time::Strptime
For more information on module installation, please visit the detailed CPAN module installation guide.