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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.