perldoc > Date::Parse

📖 NAME

Date::Parse - Parse date strings into time values

🚀 Quick Reference

Use CaseCommandDescription
Parse a date string to Unix timestampstr2time($date)Returns Unix time value or undef on failure
Parse a date string to componentsstrptime($date)Returns array of ($ss,$mm,$hh,$day,$month,$year,$zone,$century)
Parse with explicit timezonestr2time($date, $zone)Specify timezone to assume if date string lacks one
Parse in another languageDate::Language->new('German')->str2time(...)Parse dates in German, French, English, Italian

📋 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.

🔧 str2time(DATE [, ZONE])

str2time parses DATE and returns a unix time value, or undef upon failure. ZONE, if given, specifies the timezone to assume when parsing if the date string does not specify a timezone.

🔧 strptime(DATE [, ZONE])

strptime takes the same arguments as str2time but 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 $zone 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.

$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

âš ī¸ 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 <gbarr AT pobox.com>

ÂŠī¸ 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.

Date::Parse
📖 NAME 🚀 Quick Reference 📋 SYNOPSIS 📝 DESCRIPTION
🔧 str2time(DATE [, ZONE]) 🔧 strptime(DATE [, ZONE])
🌐 MULTI-LANGUAGE SUPPORT 📅 EXAMPLE DATES âš ī¸ LIMITATION 🐛 BUGS 👤 AUTHOR ÂŠī¸ COPYRIGHT

Generated by phpman v4.9.26-5-g7740029 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-08-12 20:59 @216.73.217.60
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Valid XHTML 1.0 Transitional!Valid CSS!