We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 10190
    • 187 Posts
    Hello,

    is it possible to have the date strings formatted in german? d. M. Y always give me i.e. May. as month, not Mai as it should be in german. I tried setting the language parameter to german, but this doesn’t help.

    php.net tells me to use setlocale() and strftime() functions instead of date(), but I guess I can’t do this only by hacking the snippets core, right?

    Are there any other solutions?

    Cheers,
    Frisco
      • 5811
      • 1,717 Posts
      Use :
      ---- &formatDate [ string ] (optional)
      The format of outputted dates. See http://www.php.net/manual/en/function.date.php
      by default : "d/m/y : H:i:s" e.g: 21/01/08 : 23:09:22

      d. M. Y always give me i.e. May. as month, not Mai as it should be in german
      Personally to get a French Date like 07 mai 2009, I use the following TV:
      [*setDateLocaleFR*] with the default value :
      @EVAL setlocale(LC_ALL, 'fr_FR.utf-8');

      I put this TV just after the <body> tag:
      <body >
      [*setDateLocaleFR*]

        • 10190
        • 187 Posts
        Dear coroico,

        I don’t get it working sad

        I have put up a TV [*setDateLocaleDE*] of type text, default value @EVAL setlocale(LC_ALL, ’de_DE’, ’de’, ’ge’);
        Do I have to set anything else in the TV?

        In the snippet call, I have &language=`german`&formatDate=`d. M. Y`, but the output remains:
        06. May. 2009 which is english, it should be 06. Mai 2009 in german.

        Any clues?

        Cheers
        Frisco
          • 5811
          • 1,717 Posts
          On which OS did you run your tests ? Under a XP Windows ?
          Because, I have already noticed that the setLocale doesn’t run on my laptop with widows XP. But it runs under Linux.

          Regarding windows issues with setlocale, see http://fr2.php.net/manual/en/function.setlocale.php
            • 10190
            • 187 Posts
            No, it’s linux Debian. I put the call to the TV right behind the body tag, as you recommended. Any way to debug this? I should maybe put some additional output in the TV, an echo "Here I am"?

            Cheers
            Frisco
              • 10190
              • 187 Posts
              I tried putting the TV to:

              @EVAL setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge'); echo strftime("%A %e %B %Y", mktime(0, 0, 0, 12, 22, 1978));


              which outputs: Freitag 22 Dezember 1978. That’s nice, ’cause it’s correct German.

              But the output of AjaxSearch remains 06. May. 2009, which is not nice, ’cause it’s not German wink

              Any clues?

              Cheers
              Frisco