Dates

Problems with the Windows version of XAMPP, questions, comments, and anything related.

Dates

Postby achillepieveloce » 01. March 2012 10:58

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
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003

Re: Dates

Postby JonB » 01. March 2012 15:44

Could I inquire why you installed such an old version????

:?:
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7

Re: Dates

Postby achillepieveloce » 01. March 2012 16:47

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?
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003

Re: Dates

Postby Altrea » 01. March 2012 20:13

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Dates

Postby achillepieveloce » 02. March 2012 09:59

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
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003

Re: Dates

Postby Altrea » 03. March 2012 01:18

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Dates

Postby achillepieveloce » 03. March 2012 14:09

It returns
bool(false)
What can I do now? Thanks
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003

Re: Dates

Postby Altrea » 03. March 2012 14:42

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
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
Altrea
AF Moderator
 
Posts: 8293
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: Dates

Postby achillepieveloce » 03. March 2012 15:47

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
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003

Re: Dates

Postby achillepieveloce » 06. March 2012 11:22

Can someone help me?
achillepieveloce
 
Posts: 8
Joined: 01. March 2012 10:52
Operating System: Winser2003


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 63 guests