is mktime() using date() daylight saving aware?

a 夏天 提交于 2019-12-11 05:26:31

问题


I've read through a few questions about this here on s.o. and none seem to ask or answer the question very bluntly:

$ts_today = mktime( 0, 0, 0, date('m'), date('d'), date('Y') );

is this daylight saving aware?

if not, how do i make mktime() daylight saving aware?


回答1:


~There's plenty of discussion of this on the PHP site itself, and some useful examples. In short, newer versions of PHP take account of DST as part of the timezone handling functionality




回答2:


The last argument specifies whether it's DST or not. ;)

[edit] My bad, it's actually deprecated... It now depends on the timezone you specified with date_default_timezone_set()



来源:https://stackoverflow.com/questions/2674918/is-mktime-using-date-daylight-saving-aware

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!