Page 1 of 1

Dates

PostPosted: 01. March 2012 10:58
by achillepieveloce
I have a xampp 1.6.7 on a win server 2003 and even if I set in a php page a different language all dates are in English. How can I solve this?
Thank you

Re: Dates

PostPosted: 01. March 2012 15:44
by JonB
Could I inquire why you installed such an old version????

:?:

Re: Dates

PostPosted: 01. March 2012 16:47
by achillepieveloce
I need it for a CMS I can't upgrade in this moment but I need dates in other language. could you help me, please?

Re: Dates

PostPosted: 01. March 2012 20:13
by Altrea
can you give us a sample sourcecode to bugtrack that on our own?
It's nearly impossible to help you without knowing anything about your script.

best wishes,
Altrea

Re: Dates

PostPosted: 02. March 2012 09:59
by achillepieveloce
A simple example

<?php

setlocale(LC_ALL, 'it_IT');
date_default_timezone_set('Europe/Rome');
echo date('l jS \of F Y h:i:s A');

?>


shows me

Friday 2nd of March 2012 09:59:13 AM

Re: Dates

PostPosted: 03. March 2012 01:18
by Altrea
Okay, two things:

Please check if the Locale is installed on your system:
Code: Select all
<?php
//should not return FALSE
$locale = setlocale(LC_ALL, 'it_IT');
var_dump($locale);
?>

Don't use date() but strftime().

http://www.php.net/manual/en/function.date.php wrote:To format dates in other languages, you should use the setlocale() and strftime() functions instead of date().


best wishes,
Altrea

Re: Dates

PostPosted: 03. March 2012 14:09
by achillepieveloce
It returns
bool(false)
What can I do now? Thanks

Re: Dates

PostPosted: 03. March 2012 14:42
by Altrea
Try other Language Strings:
Code: Select all
setlocale(LC_ALL, 'italian');
//or
setlocale(LC_ALL, 'italian_italy');
//or
setlocale(LC_ALL, 'ita_ita');


if you want to use it with UTF-8 you have to add the codepage:
Code: Select all
//65001 is the utf-8 codepage on Windows
setlocale(LC_ALL, 'italian.65001');
//or
setlocale(LC_ALL, 'italian_italy.65001');
//or
setlocale(LC_ALL, 'ita_ita.65001');


best wishes,
Altrea

Re: Dates

PostPosted: 03. March 2012 15:47
by achillepieveloce
Even if I put one of your options it still returns bool(flase). I tried all options and it'l always the same. any ideas? thanks

Re: Dates

PostPosted: 06. March 2012 11:22
by achillepieveloce
Can someone help me?