Time::ParseDate(3pm)
β¨ NAME β¨
okay so bestie, welcome to Time::ParseDate(3pm) β the manual page for Time::ParseDate, aka date parsing both relative and absolute π it does exactly what it says and it does it ICONICALLY.
π SYNOPSIS π
use Time::ParseDate;
$seconds_since_jan1_1970 = parsedate("12/11/94 2pm", NO_RELATIVE => 1)
$seconds_since_jan1_1970 = parsedate("12/11/94 2pm", %options)
like. that's it. that's the whole vibe. π¦
π OPTIONS π
so you can also parse dates using options, and the options are literally as follows, no skips, no caps:
FUZZYβ it's okay not to parse the entire date string πNOWβ the "current" time for relative times (defaults totime())ZONEβ local timezone (defaults to$ENV{TZ})WHOLEβ the whole input string must be parsed (no half-parse shenanigans)GMTβ input time is assumed to be GMT, not localtimeUKβ prefer UK style dates (dd/mmovermm/dd) π¬π§DATE_REQUIREDβ do not default the dateTIME_REQUIREDβ do not default the timeNO_RELATIVEβ input time is not relative toNOWTIMEFIRSTβ try parsing time before date [not default]PREFER_PASTβ when year or day of week is ambiguous, assume pastPREFER_FUTUREβ when year or day of week is ambiguous, assume futureSUBSECONDβ parse fraction seconds β±οΈVALIDATEβ only accept normal values forHHMMSS,YYMMDD. Otherwise days like-1might give the last day of the previous month.
ngl thatVALIDATEone is the one to remember, because without it-1is gonna do the little time-travel thing and hand you the last day of the previous month π
π DATE FORMATS RECOGNIZED π
πΈ Absolute date formats
Dow, dd Mon yyDow, dd Mon yyyyDow, dd Mondd Mon yydd Mon yyyyMonth day{st,nd,rd,th}, yearMonth day{st,nd,rd,th}Mon dd yyyyyyyy/mm/ddyyyy-mm-dd(usually the best date specification syntax) π₯yyyy/mmmm/dd/yymm/dd/yyyymm/yyyy/mm(only if year > 12, or > 31 ifUK)yy/mm/dd(only if year > 12 and day < 32, or year > 31 ifUK)dd/mm/yy(only ifUK, or an invalidmm/dd/yyoryy/mm/dd)dd/mm/yyyy(only ifUK, or an invalidmm/dd/yyyy)dd/mm(only ifUK, or an invalidmm/dd)
π¦ Relative date formats:
count "days"count "weeks"count "months"count "years"Dow "after next"Dow "before last"Dow(requiresPREFER_PASTorPREFER_FUTURE)"next" Dow"tomorrow""today""yesterday""last" dow"last week""now""now" "+" count units"now" "-" count units"+" count units"-" count unitscount units "ago"
β Absolute time formats:
hh:mm:ss[.ddd]hh:mmhh:mm[AP]Mhh[AP]Mhhmmss[[AP]M]"noon""midnight"
π Relative time formats:
count "minutes"(count can be franctional"1.5"or"1 1/2")count "seconds"count "hours""+" count units"+" count"-" count units"-" countcount units "ago"
π§ Timezone formats:
[+-]ddddGMT[+-]d+[+-]dddd (TZN)TZN
π Special formats:
[ d]d/Mon/yyyy:hh:mm:ss [[+-]dddd]yy/mm/dd.hh:mm
π DESCRIPTION π
This module recognizes the above date/time formats. Usually a date and a time are specified together, because we are not animals. There are numerous options for controlling what is recognized and what is not.
The return code is always the time in seconds since January 1st, 1970 or undef if it was unable to parse the time.
If a timezone is specified it must be after the time. Year specifications can be tacked onto the end of absolute times.
If parsedate() is called from array context, then it will return two elements. On successful parses, it will return the seconds and what remains of its input string. On unsuccessful parses, it will return "undef" and an error string.
π EXAMPLES π
$seconds = parsedate("Mon Jan 2 04:24:27 1995");
$seconds = parsedate("Tue Apr 4 00:22:12 PDT 1995");
$seconds = parsedate("04.04.95 00:22", ZONE => PDT);
$seconds = parsedate("Jan 1 1999 11:23:34.578", SUBSECOND => 1);
$seconds = parsedate("122212 950404", ZONE => PDT, TIMEFIRST => 1);
$seconds = parsedate("+3 secs", NOW => 796978800);
$seconds = parsedate("2 months", NOW => 796720932);
$seconds = parsedate("last Tuesday");
$seconds = parsedate("Sunday before last");
($seconds, $remaining) = parsedate("today is the day");
($seconds, $error) = parsedate("today is", WHOLE=>1);
π«Ά AUTHOR π«Ά
Best Practical Solutions, LLC modules@bestpractical.com
π« ORIGINAL AUTHOR π«
David Muir Sharnoff
π BUGS π
All bugs should be reported via email to
L<bug-Time-ParseDate@rt.cpan.org|mailto:bug-Time-ParseDate@rt.cpan.org>
or via the web at
L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=Time-ParseDate>.
bestie if you find a bug, TELL THEM, don't just suffer in silence π
π LICENSE AND COPYRIGHT π
Copyright (C) 1996-2010 David Muir Sharnoff. Copyright (C) 2011 Google, Inc. Copyright (C) 2026 Best Practical Solutions, LLC.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
and that's the whole page, you ate that π
the version info on the bottom line says perl v5.40.1 and it's dated 2026-02-28 β so go forth and parse dates, periodt πβ¨π¦
π¦ where this page comes from
- ubuntu stonking: libtime-parsedate-perl 2026.0219-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms