If I use

$end_date_formatted = date("F d, Y", mktime(0, 0, 0, $month_end, $day_end, $year_end));

it returns correct date based on values of $month_end, $day_end, $year_end.

But if I use

setlocale(LC_ALL, 'fr_FR');
$end_date_formatted = utf8_encode(strftime("%d %B %G", mktime(0, 0, 0, $day_end, $month_end, $year_end)))

A completely diferent date is returned.It shows 12 février 2015, it should display 26 Decembre 2013

有帮助吗?

解决方案

mktime(0, 0, 0, $month_end, $day_end, $year_end)))

vs

mktime(0, 0, 0, $day_end, $month_end, $year_end)))

In one you are getting the 12th month, in one the 12th day. In the other you are getting the 26th month (so it's adding some years), in the other the 26th day.

That's the issue.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top