【问题标题】:strftime not displaying current datestrftime 不显示当前日期
【发布时间】:2013-12-29 16:37:33
【问题描述】:

如果我使用

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

它根据 $month_end、$day_end、$year_end 的值返回正确的日期。

但是如果我使用

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

返回一个完全不同的日期。它显示 12 février 2015,它应该显示 26 Decembre 2013

【问题讨论】:

    标签: php timestamp locale strftime


    【解决方案1】:
    mktime(0, 0, 0, $month_end, $day_end, $year_end)))
    

    对

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

    在一个你得到第 12 个月,在一个第 12 天。在另一个你得到第 26 个月(所以它增加了一些年),在另一个第 26 天。

    这就是问题所在。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-22
      • 2015-12-08
      • 2013-10-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多