lundi 17 novembre 2014

Change php date output language


Vote count:

0




I am using few variables to store different php dates in desired formats like following:



$today = date('Y-m-d');
$todayPretty = date('d. M');
$oneMonthBefore = date('Y-m-d', strtotime('-1 months'));
$oneMonthBeforePretty = date('d. M', strtotime('-1 months'));
$oneMonthBefore2 = date('Y-m-d', strtotime($this->oneMonthBefore .' -1 day'));
$oneMonthBefore2Pretty = date('d. M', strtotime($this->oneMonthBefore .' -1 day'));
$twoMonthsBefore = date('Y-m-d', strtotime('-2 months'));
$twoMonthsBeforePretty = date('d. M', strtotime('-2 months'));
$currentMonth = date('F');
$previousMonth = date('F', strtotime('-1 months'));


Unfortunately I need them in a different language like danish for example so I've set up the following with no results:



setlocale(LC_ALL, "da_DK.UTF-8");


I've read that I have to use strftime function but how I should approach this when it comes to the variables that doesn't use strtotime in my case? Any help or guidance is more than welcomed.



asked 55 secs ago







Change php date output language

Aucun commentaire:

Enregistrer un commentaire