in reply to Re^3: Date::Parse - how to correctly parse dates between 1901 and 1969
in thread Date::Parse - how to correctly parse dates between 1901 and 1969
#!/usr/bin/perl -- use strict; use warnings; use DateTime; use DateTime::Format::Natural; my @dates = ( "2018-02-20 00:00:00", "20180220", "02/20/2018", "02/20/18", # interpreted as 1918-02-20 "2018-02-20", "today", "now", ); my $dfn = DateTime::Format::Natural->new; print $dfn->parse_datetime($_),$/ for @dates; __END__ 2018-02-20T00:00:00 2018-02-20T21:12:19 2018-02-20T21:12:19 2018-02-20T21:12:19 2018-02-20T00:00:00 2018-02-20T00:00:00 2018-02-20T21:12:19
|
|---|