Codex

Date::Parse

Section: User Contributed Perl Documentation (3pm)

Updated: 2014-04-11

Index?action=index Return to Main Contents


NAME

Date::Parse - Parse date strings into time values

SYNOPSIS

DESCRIPTION

provides two routines for parsing date strings into time values.
str2time(DATE [, ZONE])
parses and returns a unix time value, or undef upon failure. , if given, specifies the timezone to assume when parsing if the date string does not specify a timezone.:
strptime(DATE [, ZONE])
takes the same arguments as str2time but returns an array of values . Elements are only defined if they could be extracted from the date string. The element is the timezone offset in seconds from GMT. An empty array is returned upon failure.:

MULTI-LANGUAGE SUPPORT

Date::Parse is capable of parsing dates in several languages, these include English, French, German and Italian.

EXAMPLE DATES

Below is a sample list of dates that are known to be parsable with Date::Parse

LIMITATION

Date::Parse uses Time::Local internally, so is limited to only parsing dates which result in valid values for Time::Local::timelocal. This generally means dates between 1901-12-17 00:00:00 GMT and 2038-01-16 23:59:59 GMT

BUGS

When both the month and the date are specified in the date as numbers they are always parsed assuming that the month number comes before the date. This is the usual format used in American dates.

The reason why it is like this and not dynamic is that it must be deterministic. Several people have suggested using the current locale, but this will not work as the date being parsed may not be in the format of the current locale.

My plans to address this, which will be in a future release, is to allow the programmer to state what order they want these values parsed in.

AUTHOR

Graham Barr <[email protected]>

COPYRIGHT

Copyright (c) 1995-2009 Graham Barr. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.


Index

NAME

SYNOPSIS

DESCRIPTION

MULTI-LANGUAGE SUPPORT

EXAMPLE DATES

LIMITATION

BUGS

AUTHOR

COPYRIGHT