php - strftime giving wrong month name (February only...) -
i have following code, month name of date, , using name of month in hebrew.
$thismonthname = date("f", mktime(0, 0, 0, $thismonthnumber, 10)); date_default_timezone_set('asia/tel_aviv'); // set timezone israel $locale = 'he_il.utf8'; setlocale(lc_all, $locale); // set locale hebrew $thismonthnameheb = strftime('%b', strtotime($thismonthname));
it works perfectly, except february.
when print out $thismonthname says "february" when print out $thismonthnameheb says מרץ (march) in hebrew.
going crazy, can't figure out.
you're doing conversion time string , back.
instead of converting time -> string -> time
, keep time value , base results on that:
$thismonthtime = mktime(0, 0, 0, $thismonthnumber, 10); $thismonthname = date("f", $thismonthtime); date_default_timezone_set('asia/tel_aviv'); // set timezone israel $locale = 'he_il.utf8'; setlocale(lc_all, $locale); // set locale hebrew $thismonthnameheb = strftime('%b', $thismonthtime);
Comments
Post a Comment