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
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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.