Copyright (C) 2000-2012 |
Manpages Date::ParseSection: User Contributed Perl Documentation (3)Updated: 2002-01-09 Index Return to Main Contents NAMEDate::Parse - Parse date strings into time valuesSYNOPSISuse Date::Parse; $time = str2time($date); ($ss,$mm,$hh,$day,$month,$year,$zone) = strptime($date); DESCRIPTION"Date::Parse" provides two routines for parsing date strings into time values.
MULTI-LANGUAGE SUPPORTDate::Parse is capable of parsing dates in several languages, these are English, French, German and Italian. Changing the language is done via a static method call, for example
Date::Parse->language('German');will cause Date::Parse to attempt to parse any subsequent dates in German. This is only a first pass, I am considering changing this to be
$lang = Date::Language->new('German'); $lang->str2time("25 Jun 1996 21:09:55 +0100");I am open to suggestions on this. EXAMPLE DATESBelow is a sample list of dates that are known to be parsable with Date::Parse
1995:01:24T09:08:17.1823213 ISO-8601 1995-01-24T09:08:17.1823213 Wed, 16 Jun 94 07:29:35 CST Comma and day name are optional Thu, 13 Oct 94 10:13:13 -0700 Wed, 9 Nov 1994 09:50:32 -0500 (EST) Text in ()'s will be ignored. 21 dec 17:05 Will be parsed in the current time zone 21-dec 17:05 21/dec 17:05 21/dec/93 17:05 1999 10:02:18 "GMT" 16 Nov 94 22:28:20 PST BUGSWhen 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. AUTHORGraham Barr <gbarr@pobox.com>COPYRIGHTCopyright (c) 1995 Graham Barr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
IndexThis document was created by man2html, using the manual pages. Time: 12:34:45 GMT, April 26, 2024 |