Results 1 to 4 of 4

Thread: date() function

  1. #1

    * printing date() function in spanish :(

    Hello mates,

    I need to print date(); function (PHP) in spanish.
    Is it possible?
    Could you help me please?
    Thanks!

    P.S.
    Actually my code is:
    PHP Code:
    <?php echo date('F j, Y'); ?>
    But it is english...
    Last edited by solid hoster; 03-11-2004 at 06:20 PM.

  2. #2
    Join Date
    Aug 2003
    Location
    Barrie, ON, Canada
    Posts
    6
    Try this...
    PHP Code:
    setlocale(LC_TIME,"spanish");
    echo 
    strftime ('%B %d, %Y'); 
    try refering to php.net/setlocale if the words don't come up in spanish...

    Cheers
    Richard

  3. #3
    Thank you Richard!

  4. #4
    Join Date
    Feb 2004
    Posts
    772
    Hi Solid hoster,

    As suggested by W-S-Nexus , You have to use setlocale function to print date according to your required format.

    Here's the code which will print the date in spanish format

    <?php
    setlocale (LC_TIME,"spanish");
    $long_date = str_replace("De","de",ucwords(strftime("%A, %d de %B de %Y")));
    echo $long_date;
    ?>


    For more details please refer the given below URL:

    http://in2.php.net/manual/en/function.setlocale.php

    Regards

    Bright

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •