Re: convert date in german format

From: Date: Wed, 26 Nov 2003 16:55:56 +0000
Subject: Re: convert date in german format
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-31775@lists.php.net to get a copy of this message
at the top of your script, do: setlocale ( LC_TIME, 'de_DE' ) ; (assumes your machine has German support installed) Yes, this is really the "right" way to do date display for different locales, but it also requries that you use the strftime() function instead of date().
Like date(), strftime() will expect the second param to be a unix timestamp, so you still have to deal with that issue. strftime() will provide much more flexibility in displaying german dates -- e.g. ability to have German days of week, month names, etc. Using MySQL DATE_FORMAT() would work, but it's a hack solution; if you ever wanted to create an English version of your site you would have to make changes to your data-layer queries -- and that's just not where that logic belongs. Hans

« previous php.db (#31775) next »