PHP Local Date

Using date and time functions in PHP is as easy as it gets. However there are times when the website you build is addressed to a non-English audience, let’s say Greek.

We know that date(“F”) will echo “January” if we are in January and so on. So what if we wanted to echo the current month in Greek (January = Ιανουάριος)?

The following code snipped will say everything it needs to:
setlocale(LC_TIME, ‘greek’);
echo strftime(“%B”); //Ιανουάριος

Note: On some windows systems the above code won’t work so you may want to try:
setlocale(LC_CTYPE, ‘greek’);
setlocale(LC_TIME, ‘greek’);
echo strftime(“%B”); //Ιανουάριος