开发者

PHP Mktime error

开发者 https://www.devze.com 2023-03-21 10:25 出处:网络
I\'m all of a sudden getting the following error on a site that I\'ve done, which has been working fine so far:

I'm all of a sudden getting the following error on a site that I've done, which has been working fine so far:

A PHP Error was encountered

Severity: Warning

Message: mktime() [function.mktime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Antarctica/Macquarie' for 'EST/10.0/no DST' instead

This is the code in question:

$stamp=mktime(0,0,0,$month,$day,$year);

What's the issue here? How can I q开发者_开发问答uickly make these errors go away? I'm using mktime in that format in a lot of places and its throwing an error in each place.


As the error says, you either need to specify a timezone using date_default_timezone_set('Antarctica/Macquarie'); or ini_set('date.timezone', 'Antarctica/Macquarie'); in your code or define date.timezone in php.ini.


Can you confirm that $month, $day, and $year are INT - or even not NULL?

Also look into date_default_timezone_set()

0

精彩评论

暂无评论...
验证码 换一张
取 消