atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 3 forks source link

Date::Parse is able to parse ludicrous dates [rt.cpan.org #70650] #27

Open atoomic opened 4 years ago

atoomic commented 4 years ago

Migrated from rt.cpan.org#70650 (status was 'open')

Requestors:

From njh@bandsman.co.uk on 2011-08-31 18:50:52 :

Looking at the documentation I have no idea why this program works, or
what the value is that it prints out.  A parser should do syntax
checking and not make undocumented assumptions.

#!/usr/bin/perl

use Date::Parse;

$time = str2time('1');

print "$time\n";

From gbarr@pobox.com on 2011-08-31 19:28:07 :

Date::parse is all about making assumptions to guess the date from the string. If you want to parse dates in a particular format then I would suggest looking at DateTime::Format modules.