I'm trying to parse and reformat date strings which look like this on input:
11 Mär 08 22:54 CET
The formats may vary slightly, but they all have in common that months are in German. Date::Manip generally does support parsing dates in several languages, and although this generally works fine, there seems to be a problem with the month "Mär" (March).
Here's some demo code:
use Date::Manip; Date_Init("Language=German", "DateFormat=non-US", "TZ=UTC"); for my $date_in ( "11 Jan 08 22:54 CET", "11 Mär 08 22:54 CET", "11 Mai 08 22:54 CEST", "11 Okt 08 22:54 CEST", "11 Dez 08 22:54 CET", ) { my $date_out = UnixDate( ParseDate($date_in), "%Y-%m-%d_%H:%M:%S" +); printf "%-20s --> %s\n", $date_in, $date_out; }
The output:
11 Jan 08 22:54 CET --> 2008-01-11_21:54:00 11 Mär 08 22:54 CET --> 11 Mai 08 22:54 CEST --> 2008-05-11_20:54:00 11 Okt 08 22:54 CEST --> 2008-10-11_20:54:00 11 Dez 08 22:54 CET --> 2008-12-11_21:54:00
The expected output for 11 Mär 08 22:54 CET would be 2008-03-11_21:54:00
Suspecting some encoding issue, I also tried to supply the input as Unicode (UTF-8) instead of ISO Latin-1. Same result. (Taking a look at the source suggests the module isn't using Unicode. But just in case.)
So what am I doing wrong?
(I'm using Date:Manip v5.54, as currently available from CPAN.)
In reply to Date::Manip and German months names by almut
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |