Jump to content

Time Date different languages


dmaxey

Recommended Posts

I have a time and date using the code

 

echo date("l jS \of F Y H:i:s.");

 

Now I need to show this in several different languages, including French German and Dutch

 

I have tried setlocale();

and echo strftime

 

The date shows but still in English.

Any idea how to show the day date and time in Php for the languages suggested.

 

 

Link to comment
https://forums.phpfreaks.com/topic/253937-time-date-different-languages/
Share on other sites

Thanks for your reply. I have been there before and struggled to understand.

I have tried this  but just shows jS \of F Y H:i:s.  instead of  Woensdag 28 december 2011 13:49:28.

<?php

/* Set locale to Dutch */

setlocale(LC_ALL, 'nl_NL');

echo strftime("l jS \of F  Y H:i:s.");

?>

Will you give me further advice?

Right I have

<?php

setlocale(LC_Time, 'nld_nld');

$dutch= strftime("%A %d %B %Y - %H:%M",time());

echo $dutch;

?>

which shows

woensdag 28 december 2011 - 15:36 on my wamp server. When I put it online it shows

Wednesday 28 December 2011 - 15:50

Where, exactly, am I going wrong

Finally found a way to do this. My wamp server is obviously windows but my web host is Linux.

So this goes before the head

<?php

date_default_timezone_set('Europe/madrid');

setlocale(LC_ALL, array('es.UTF-8','es_ES@euro','es_ES','spanish'));

?>

and this goes in the body

<?php

$spanish= strftime("%A %d %B %Y - %H:%M",time());

echo $spanish;

?>

Just change country identifiers for different ones.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.