Date::Parse(3)
π Date::Parse(3): parse date strings into time values π
okay so welcome to the User Contributed Perl Documentation page for Date::Parse(3), bestie. This is the module that parses date strings into time values, and it is lowkey iconic. π
β¨ NAME β¨
Date::Parse β parse date strings into time values. That's the whole name, no cap. π
πΈ SYNOPSIS πΈ
use 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. Two little functions, big main character energy. π«Ά
str2time(DATE [, ZONE])βstr2timeparsesDATEand returns a unix time value, orundefupon failure.ZONE, if given, specifies the timezone to assume when parsing if the date string does not specify a timezone. Slay. πstrptime(DATE [, ZONE])βstrptimetakes the same arguments asstr2timebut returns an array of values($ss,$mm,$hh,$day,$month,$year,$zone,$century). Elements are only defined if they could be extracted from the date string. The$zoneelement is the timezone offset in seconds from GMT. An empty array is returned upon failure. Periodt. π
π MULTI-LANGUAGE SUPPORT π
Date::Parse is capable of parsing dates in several languages, these include English, French, German and Italian. Multilingual queen behavior. πβ¨
$lang = Date::Language->new('German');
$lang->str2time("25 Jun 1996 21:09:55 +0100");
π EXAMPLE DATES π
Below 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
π LIMITATION π
Date::ParseusesTime::Localinternally, so is limited to only parsing dates which result in valid values forTime::Local::timelocal. This generally means dates between1901-12-17 00:00:00 GMTand2038-01-16 23:59:59 GMT.
That's the range, bestie β respect it. π
π 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. Month-first agenda, always. π
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.
The plan to address this β and yes, it will be in a future release β is to allow the programmer to state what order they want these values parsed in. Future slay, bestie. π₯
π AUTHOR π
Graham Barr <gbarr@pobox.com> β legend behavior. π
π¦ 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. π«Ά
okay bye bestie β this Date::Parse(3) page is from perl v5.42.0, dated 2020-05-20 πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-TimeDate 2.33-160000.2.2 Β· Artistic-1.0 OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms