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

2019-07-26 14:44发布

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?

标签: php dst mktime
2条回答
来,给爷笑一个
2楼-- · 2019-07-26 14:50

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()

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-07-26 14:51

~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

查看更多
登录 后发表回答