Php: Change language in date/strftime/strtotime -


i'm trying output on second piece of code dutch. first code gives right output, in english. tried in dutch ended 01-01-1970, 12-12-2015 or nothing. code should give next friday week, unless past monday, it's fridat next week.

my working code in english.

<?php $d = strtotime('today');  switch ($d) {     case strtotime('monday'):     case strtotime('friday'):     case strtotime('saturday'):     case strtotime('sunday'):         $ff = strtotime('next friday');         $ffn = date('l d m', $ff);         echo $ffn;     break;     case strtotime('tuesday'):     case strtotime('wednesday'):     case strtotime('thursday'):         $ff = strtotime('next friday' . '+ 7days');         $fft = date('l d m', $ff);         echo $fft;     break;     default:         echo "something went wrong"; } ?> 

my code gives dutch output, wrong date (it gives today's date, not next friday/friday next week.)

by way, first question ive asked here, might bit vague or ;)

just output date using strftime() , set_locale() functions. no need change code logic if correct.

http://php.net/manual/en/function.strftime.php

http://php.net/manual/en/function.setlocale.php

<?php $d = strtotime('today');  $format = '%a %d %b'; setlocale(lc_time, 'nl_nl');     setlocale(lc_all, 'nl_nl');  switch ($d) {     case strtotime('monday'):     case strtotime('friday'):     case strtotime('saturday'):     case strtotime('sunday'):         $ff = strtotime('next friday');         $ffn = strftime($format, $ff);         echo $ffn;     break;     case strtotime('tuesday'):     case strtotime('wednesday'):     case strtotime('thursday'):         $ff = strtotime('next friday' . '+ 7days');         $fft = strftime($format, $ff);         echo $fft;     break;     default:         echo "something went wrong"; } ?> 

Comments