Posted  13 Apr 2010 - 18:39:00

Category: PHP

PHP date in Swedish (or other languages)

You want to write a month in your own language using PHP.

First off you need to set the locale. This has to be supported by your system. You can check this on a Unix server using the command "locale -a". When you find the one you fancy, use it like in the example below. After that you need to use the function strftime instead of date to get the date representation using your locale.

setlocale(LC_ALL, 'sv_SE');
echo strftime("%ee %B %Y - %R");

Marked as helpful by 14 users


11/28/2016 6:16:02 AM  okocho  wrote:

Hi, I've tried your way, it succeeds


1/17/2012 4:24:50 AM  Lars from Sweden  wrote:

Thank you, it helped me a lot :)

5/10/2011 6:53:00 PM  ST  wrote:

I couldn't get it to work, but I tried this instead: strftime("%#d/%m/%Y - %H:%M", ->timegoeshere<-); (I use %#d instead of %e because it apparently doesn't work on windows)

© SolutionCottage 2008-2011 9/24/2017 1:13:10 PM