Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-30-2007, 06:49 PM   PM User | #1
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
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
crmpicco is offline   Reply With Quote
Old 09-30-2007, 07:12 PM   PM User | #2
Mwnciau
Regular Coder

 
Join Date: May 2006
Location: Wales
Posts: 820
Thanks: 1
Thanked 82 Times in 79 Posts
Mwnciau is on a distinguished road
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>"
Mwnciau is offline   Reply With Quote
Old 09-30-2007, 07:40 PM   PM User | #3
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
cheers mate, that writes out:

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

Picco
crmpicco is offline   Reply With Quote
Old 09-30-2007, 07:48 PM   PM User | #4
Mwnciau
Regular Coder

 
Join Date: May 2006
Location: Wales
Posts: 820
Thanks: 1
Thanked 82 Times in 79 Posts
Mwnciau is on a distinguished road
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
?>
Mwnciau is offline   Reply With Quote
Users who have thanked Mwnciau for this post:
crmpicco (09-30-2007)
Old 09-30-2007, 07:53 PM   PM User | #5
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
excellent, worked perfect!! I take it I can set the locale back to en_EN for the English part of my site?
crmpicco is offline   Reply With Quote
Old 09-30-2007, 07:54 PM   PM User | #6
crmpicco
Senior Coder

 
crmpicco's Avatar
 
Join Date: Jan 2005
Location: Mauchline, Scotland
Posts: 1,091
Thanks: 15
Thanked 1 Time in 1 Post
crmpicco has a little shameless behaviour in the past
repuation boost and a "thank" :-) cheer again bud!!!

Picco
crmpicco is offline   Reply With Quote
Old 09-30-2007, 08:00 PM   PM User | #7
Mwnciau
Regular Coder

 
Join Date: May 2006
Location: Wales
Posts: 820
Thanks: 1
Thanked 82 Times in 79 Posts
Mwnciau is on a distinguished road
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.
Mwnciau is offline   Reply With Quote
Old 02-04-2008, 11:05 AM   PM User | #8
PHPycho
Regular Coder

 
Join Date: Dec 2005
Posts: 217
Thanks: 1
Thanked 0 Times in 0 Posts
PHPycho has a little shameless behaviour in the past
sorry that doesnt work for php4. it says date_default_timezone_set() doesnt exists. whats the alternative solution for this.
PHPycho is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:58 PM.


Advertisement
Log in to turn off these ads.