Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post

    Arrow display date in German - php date strftime

    Code:
    <?php
    date_default_timezone_set('Europe/Berlin'); 
    // Set the gloabal LC_TIME constant to german
    setlocale(LC_TIME, 'de_DE');
    // Little bit other Syntax but better effect
    echo "time " . strftime('%A, %d. %B %Y') . "<br>"; //Output: Mittwoch, 07. September 2005
    ?>
    I am attempting to display the date in German with the code above. Can anyone tell me how it is done as it is still showing in English.

    Cheers, Picco

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    PHP Code:
    if($lc setlocale(LC_ALL"de_DE""de_DE@euro""deu""deu_deu""german"))
    echo 
    "<p>Locale setting is \"$lc\".</p>";
    else
    echo 
    "<p>Couldn't change to a German locale.</p>"

  • #3
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post
    cheers mate, that writes out:

    Code:
    Locale setting is "German_Germany.1252".
    So how can I change "Sunday 30th September" to "Sonntag 30....."???

    Picco

  • #4
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    PHP Code:
    <?php
    date_default_timezone_set
    ('Europe/Berlin'); 
    // Set the gloabal LC_TIME constant to german
    setlocale(LC_ALL"de_DE""de_DE@euro""deu""deu_deu""german")
    // Little bit other Syntax but better effect
    echo "time " strftime('%A, %d. %B %Y') . "<br>"//Output: Mittwoch, 07. September 2005
    ?>

  • Users who have thanked Mwnciau for this post:

    crmpicco (09-30-2007)

  • #5
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post
    excellent, worked perfect!! I take it I can set the locale back to en_EN for the English part of my site?

  • #6
    Senior Coder crmpicco's Avatar
    Join Date
    Jan 2005
    Location
    Mauchline, Scotland
    Posts
    1,093
    Thanks
    15
    Thanked 1 Time in 1 Post
    repuation boost and a "thank" :-) cheer again bud!!!

    Picco

  • #7
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts
    Quote Originally Posted by crmpicco View Post
    excellent, worked perfect!! I take it I can set the locale back to en_EN for the English part of my site?
    If not en_EN then one of the ones found on MSDN.

  • #8
    Regular Coder
    Join Date
    Dec 2005
    Posts
    217
    Thanks
    1
    Thanked 0 Times in 0 Posts
    sorry that doesnt work for php4. it says date_default_timezone_set() doesnt exists. whats the alternative solution for this.


  •  

    Posting Permissions

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