Jump to content
Killersites Forums

Time and Date


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 post
Share on other sites

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.

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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...