Pike v8.0 release 1738

Method Calendar.YMD.parse()


Method parse

TimeRange parse(string fmt, string arg)

Description

parse a date, create relevant object fmt is in the format "abc%xdef..." where abc and def is matched, and %x is one of those time units:

%Y absolute year
%y dwim year (70-99 is 1970-1999, 0-69 is 2000-2069)
%M month (number, name or short name) (needs %y)
%W week (needs %y)
%D date (needs %y, %m)
%d short date (20000304, 000304)
%a day (needs %y)
%e weekday (needs %y, %w)
%h hour (needs %d, %D or %W)
%m minute (needs %h)
%s second (needs %m)
%S seconds since the Epoch (only combines with %f)
%f fraction of a second (needs %s or %S)
%t short time (205314, 2053)
%z zone
%p "am" or "pm"
%n empty string (to be put at the end of formats)

Returns

0 if format doesn't match data, or the appropriate time object.

Note

The zone will be a guess if it doesn't state an exact regional timezone (like "Europe/Stockholm") - most zone abbriviations (like "CET") are used by more then one region with it's own daylight saving rules. Also beware that for instance CST can be up to four different zones, central Australia or America being the most common.

Abbreviation Interpretation
AMT          America/Manaus       [UTC-4]
AST          America/Curacao      [UTC-4]
CDT          America/Costa_Rica   [UTC-6]
CST          America/El Salvador  [UTC-6]
EST          America/Panama       [UTC-5]
GST          Asia/Dubai           [UTC+4]
IST          Asia/Jerusalem       [UTC+2]
WST          Australia/Perth      [UTC+8]

This mapping is modifiable in the ruleset, see Ruleset.set_abbr2zone.