Subject: | Default nginx time format is not parsed |
Date: | Sun, 6 Oct 2013 19:19:27 -0700 |
To: | bug-Date-Manip [...] rt.cpan.org |
From: | Eli Lindsey <eli [...] siliconsprawl.com> |
Nginx uses a somewhat quirky default date format in its logs:
dd/Mon/yyyy:hh:mm:ss
eg. 07/Oct/2013:00:31:34 +0000
The quirky bit is the colon between the date and time. ParseDate doesn't handle this, though it will parse properly if that colon is converted to a space.
Time::ParseDate includes this as a special format; it'd be very useful if Date::Manip could also recognize it.
http://search.cpan.org/~muir/Time-ParseDate-2013.0920/lib/Time/ParseDate.pm#Special_formats:
Repro -
[eli@flatline:~/]$ cat test.pl
use Date::Manip;
print $Date::Manip::VERSION . "\n";
# date with colon, isn't parsed
print ParseDate("07/Oct/2013:00:31:34 +0000") . "\n";
# date with space instead of colon; is parsed
print ParseDate("07/Oct/2013 00:31:34 +0000") . "\n";
[eli@flatline:~/]$ perl test.pl
6.41
2013100617:31:34