From The Blog

PHP: Problem getting date in different locale

26 November 2013, in PHP

Have you ever faced a problem trying to get date in another locale ?

The way you can do it right is as follows:

You will use set setlocale(), strftime()

suppose you want to get the date in Italian

setlocale(LC_ALL, 'it_IT'); // Set locale to Italian

echo strftime("%e %B %Y"); //today's date

echo strftime("%e %B %Y",strtotime($date)); //another date



Post a Comment