[Windows + PHP5] Localizing date()?

This is a discussion on [Windows + PHP5] Localizing date()? within the PHP Language forums, part of the PHP Programming Forums category; Hello I'm trying to localize a small PHP application which uses date() to display a date saved as Epoch ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-28-2007
Gilles Ganault
 
Posts: n/a
Default [Windows + PHP5] Localizing date()?

Hello

I'm trying to localize a small PHP application which uses
date() to display a date saved as Epoch in MySQL, but I can't get the
month to be displayed in French:

=========
//BAD setlocale(LC_ALL, 'fr_FR@euro', 'fr_FR', 'fra_fra');
//BAD setlocale(LC_ALL, 'fra_fra');
//BAD setlocale(LC_ALL, 'french');
//BAD setlocale(LC_ALL, 'fr_FR');
//BAD setlocale(LC_ALL, 'fr-FR');
//BAD setlocale(LC_ALL, 'fr');
//BAD too
setlocale(LC_ALL, 'French');

//27 December 2007 instead of
//27 décembre 2007
echo date('d F Y', '1198790064');
=========

I read the comments in www.php.net/date , and was wondering...

1. Why PHP5 seems to have a problem with locales, and

2. What would be the least complicated way to change this call to
date()?

Thank you.
Reply With Quote
  #2 (permalink)  
Old 12-28-2007
Gilles Ganault
 
Posts: n/a
Default Re: [Windows + PHP5] Localizing date()?

On Fri, 28 Dec 2007 04:10:57 +0100, Gilles Ganault <nospam@nospam.com>
wrote:
>2. What would be the least complicated way to change this call to
>date()?


For those interested, it seems like date() always displays date/time
using the US locale, while strftime() uses the selected locale.

For instance, the following does display the date according to the
French locale:

===========
setlocale(LC_ALL, 'French');

//27 December 2007
echo date('d F Y', '1198790064') . "<p>";

//27 décembre 2007
echo strftime('%d %B %Y', '1198790064');
===========

HTH,
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:29 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0