- STRPTIME PATTERN TOKENS
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:
The default time zone to use for objects returned from parsing.
The locale to use for objects returned from parsing.
Strict range check for date and time.
"2016-02-31"is wrong date string, but Time::Strptime parses as
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.
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.)
Equivalent to %Y-%m-%d. (This is the ISO style date)
The hour (00-23). This will parse single digit numbers as well.
The hour on a 12-hour clock (1-12).
The day number in the year (1-366).
The month number (01-12). This will parse single digit numbers as well.
The minute (00-59). This will parse single digit numbers as well.
Arbitrary white-space. (ignored)
The equivalent of AM or PM according to the locale in use. (See DateTime::Locale)
Equivalent to %I:%M:%S %p.
Equivalent to %H:%M.
Number of seconds since the Epoch.
The second (0-60; 60 may occur for leap seconds.).
Tab space. (ignored)
Equivalent to %H:%M:%S.
A 4-digit year, including century (for example, 1991).
An RFC-822/ISO 8601 standard time zone specification. (e.g. +1100)
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.