Convert an input string to a date under the control of a template string. Return a newly created date object.
Literal characters in template must match characters in input and ‘~’ escapes must match the input forms described in the table below. “Skip to” means characters up to one of the given type are ignored, or “no skip” for no skipping. “Read” is what’s then read, and “Set” is the field affected in the date object.
For example ‘~Y’ skips input characters until a digit is reached, at which point it expects a year and stores that to the year field of the date.
|no skip||literal ~||nothing|
|locale abbreviated weekday name||nothing|
|locale full weekday name||nothing|
|locale abbreviated month name|
|locale full month name|
|day of month|
|no skip||day of month, blank padded|
|same as ‘~b’|
|no skip||hour, blank padded|
|no skip||2-digit year|
|no skip||time zone||date-zone-offset|
Notice that the weekday matching forms don’t affect the date object returned, instead the weekday will be derived from the day, month and year.
Conversion is locale-dependent on systems that support it
(see Accessing Locale Information). See
setlocale, for information on how to change the current