SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    locale does not work on date but does on strfrtime?

    I am setting the locale to dutch, but it does not work on the date function but it does work on strfrtime();

    example:

    PHP Code:
    <?php
    /** Set locale to dutch **/
    if(function_exists('setlocale')){
        
    setlocale(LC_ALL'nl_NL');
    }

    echo 
    date('l F Y'strtotime('2008-07-08'));
    // Output Tuesday July 2008

    echo strftime('%A %B %G'strtotime('2008-07-08'));
    //  dinsdag juli 2008
    ?>
    Does anybody know what is wrong
    Go visit my site you know you want to
    http://con.cept.me

  2. #2
    SitePoint Addict
    Join Date
    Dec 2007
    Posts
    358
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This behavior is by design.

    http://php.net/manual/en/function.date.php
    To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().
    I'm creating trouble-free Apache, PHP, MySQL installer, WITSuite,
    and use it to setup my development environment.
    Demo, support, contact. Questions?

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2006
    Posts
    63
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh yes overlooked it, why does it always use the english format?
    Go visit my site you know you want to
    http://con.cept.me

  4. #4
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    Location
    CA
    Posts
    9,013
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    Because English is the most common? *shrugs* dunno.
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.



Bookmarks

Posting Permissions

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