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

    i am using the dateFormat param like this:

    &dateFormat=`%jS %B, %Y`

    hoping to get this:
    9th January, 2007

    but i get this:

    004S January, 2007

    anyone know what i am doing wrong?

    g.
      • 7923
      • 4,213 Posts
      First, which function is used to output the date in the resource? Probably date or strftime.. Then get the correct format syntax from date or strftime documentation.


        "He can have a lollipop any time he wants to. That's what it means to be a programmer."
        • 10357
        • 573 Posts
        ah thank you, i was looking at the wrong documentation.

        although it does not seem possible to display th, st, rd with smrftime
          • 7923
          • 4,213 Posts
          Yes, it seems so.. odd.


            "He can have a lollipop any time he wants to. That's what it means to be a programmer."
            • 19889
            • 616 Posts
            Quote from: doze at Jan 10, 2007, 12:33 PM

            First, which function is used to output the date in the resource? Probably date or strftime.. Then get the correct format syntax from date or strftime documentation.

            that seems to work - however, how can I get the month e.g. ’January’ in German - I guess I have to use setlocale somewhere but I don’t know how.

            thank you in advance for your input
              • 7923
              • 4,213 Posts
              Yeah, you could do setlocale(LC_ALL, ’de_DE’); in the snippet, or in config.inc.php so that every snippet that uses strftime function to format the date will do it in german right away.


                "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                • 19638
                • 39 Posts
                Thank Doze !
                I have done like this for my template :
                1) i have created a template variable "setdatelocale" with content :

                @EVAL setlocale(LC_ALL, 'fr_FR');
                (french in my case)
                2) i call it with [*setdatelocale*] in my default template

                Like this i do not need to touch main php scripts and/or all snipnets . (I suppose this can be done better for multilingual content ).
                  • 23802
                  • 65 Posts
                  Guys i’m testing this system on localhost , it gives me Jan 01 of 1970 if i use TV with date formatter type. I guess it’s Unix time or something like that.

                  Is it possible to fix it?
                    • 7923
                    • 4,213 Posts
                    What is it that you are doing? Post the code..


                      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
                      • 18830
                      • 161 Posts
                      Quote from: pr0ph3t at Jan 28, 2007, 02:00 AM

                      It gives me Jan 01 of 1970 if i use TV with date formatter type.

                      Which date do you want do fetch? createdon, pub_date, unpub_date? If you didn’t set pub_date for example and ask for it in your snippet, it will return Jan 01 of 1970. Createdon should work anytime.