0
echo date('Y-m-d',time())
我得到2012-07-16,但是當Smarty的輸出爲什麼Smarty的功能DATE_FORMAT得到錯誤的時間
{$smarty.now | date_format : "%Y-%I-%d"}
我得到2012-04-16
我一直sured time_zone設置正確。
echo date('Y-m-d',time())
我得到2012-07-16,但是當Smarty的輸出爲什麼Smarty的功能DATE_FORMAT得到錯誤的時間
{$smarty.now | date_format : "%Y-%I-%d"}
我得到2012-04-16
我一直sured time_zone設置正確。
因爲%I
是小時...嘗試:
{$smarty.now | date_format : "%Y-%m-%d"}
%M - 每月的十進制數(範圍從01到12)
哦,我的。 ..這麼愚蠢的錯誤... Thx很多! – tinybai 2012-07-16 09:07:16
如果你使用的是Smarty3,你也可以使用date()格式:'{$ smarty.now | date_format:「Y-m-d」}' – rodneyrehm 2012-07-16 09:08:44