Announcement

Collapse
No announcement yet.

PHP - date() function in French?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHP - date() function in French?

    Hi everyone,

    I added the date() function in my site to display current date, but by default, the date shown is in English. Does anybody know how to modify this date() function in order to display it into another language, notably French?
    Thanks so much in advance.

    Herman

  • #2
    Re: PHP - date() function in French?

    You would need to change the locale (in the same page where you have the date function). Look at www.php.net
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment


    • #3
      Re: PHP - date() function in French?

      Hi Naval,

      Thanks so much!

      I looked at PHP.net and was able to come up with this code for my date:

      PHP Code:
      <?php
      setlocale
      (LC_ALL'fr_FR');

      echo 
      strftime("%A %e %B %Y");
      ?>
      It displays the current time in French, exactly what I wanted. But my concern is to know whether this current time will change daily as it does with date("d/m/Y") function. Will the script update itself tomorrow and any other day? Do they have to work together? If so, I am afraid I don't know how to work with both date() and setlocale() in a same script. Will you help me with that, please?
      A million thank yous in advance!

      Herman

      Comment


      • #4
        Re: PHP - date() function in French?

        It will stay updated with the current day. The one thing you might have to worry about is the difference between the server time and your local time.

        There is a second parameter to the function where you can insert a timestamp.

        You can do something like

        PHP Code:
        echo strftime("%A %e %B %Y"time()+#); 
        Replacing # with some type of offset to adjust the time to your timezone.

        Register/Login Script
        Do you use a Password Protected Directory? Need a way to allow users to make their own account, try my .htaccess Login Script

        Comment


        • #5
          Re: PHP - date() function in French?

          Hello Watdaflip,

          Thanks for the warning. But what can "#" possibly be in the second parameter of strftime()? My local time zone is the US Central Time (therefore -006 UTC).
          Any idea how I could reformat strftime() based on this factor?
          I am very limited knowledge of PHP, so please go easy on me in your explanations Thanks so much for your help,

          Herman

          Comment


          • #6
            Re: PHP - date() function in French?

            # = number in seconds, being that the time difference between your time and the GMT.
            Navaldesign
            Logger Lite: Low Cost, Customizable, multifeatured Login script
            Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
            DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
            Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

            Comment

            Working...
            X