Enjoy an ad free experience by logging in. Not a member yet?
Register .
09-30-2007, 06:49 PM
PM User |
#1
Senior Coder
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
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
09-30-2007, 07:12 PM
PM User |
#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>" ;
09-30-2007, 07:40 PM
PM User |
#3
Senior Coder
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
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
09-30-2007, 07:48 PM
PM User |
#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:
09-30-2007, 07:53 PM
PM User |
#5
Senior Coder
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
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?
09-30-2007, 07:54 PM
PM User |
#6
Senior Coder
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
repuation boost and a "thank" :-) cheer again bud!!!
Picco
09-30-2007, 08:00 PM
PM User |
#7
Regular Coder
Join Date: May 2006
Location: Wales
Posts: 820
Thanks: 1
Thanked 82 Times in 79 Posts
Quote:
Originally Posted by
crmpicco
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 .
02-04-2008, 11:05 AM
PM User |
#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.
Jump To Top of Thread
Thread Tools
Rate This Thread
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
All times are GMT +1. The time now is 10:58 PM .
Advertisement
Log in to turn off these ads.