Skip to content Skip to sidebar Skip to footer

How To Change 'timestamp'-column Language In Mysql?

I have a column which is a Timestamp. It records something like: 2010-02-08 12:10:22 Then I use this in php: $postdate = date( 'j F', strtotime( $row['modify_date'] ) ); And it c

Solution 1:

The native PHP function for that is strftime().

%B Full month name, based on the locale January through December

if the server is not in the swedish locale, use setlocale().

That said, I have had so many troubles with setlocale() in the past, especially on shared hosting, that I tend to keep an array of month names in whatever config file / dictionary file the project has:

$monthnames["de"] = array("Januar", "Februar", "März", "...");
$monthnames["fi"] = array("Tammikuu", "Helmikuu", "...");


echo$monthnames[$language][date("n", strtotime( $row['modify_date'] ))]; 

Solution 2:

If you use setlocale() then you can output locale-specific names via strftime().

Post a Comment for "How To Change 'timestamp'-column Language In Mysql?"