Re: convert date in german format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux