NAME
Time::Strptime::Format - strptime(3) format compiler and parser.
SYNOPSIS
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');
DESCRIPTION
This is Time::Strptime engine.
METHODS
This class offers the following methods.
Time::Strptime::Format->new($format, \%args)
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.
strict
Strict range check for date and time.
Example.
"2016-02-31"
is wrong date string, but Time::Strptime parses as2016-02-31
in default.
$strptime->parse($string)
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.
STRPTIME PATTERN TOKENS
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)
LICENSE
Copyright (C) karupanerura.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
karupanerura <karupa@cpan.org>