`[Exception] DateTime :: __ construct():`依靠系统的时区设置是不安全的 [英] `[Exception] DateTime::__construct(): `It is not safe to rely on the system's timezone settings

查看:179
本文介绍了`[Exception] DateTime :: __ construct():`依靠系统的时区设置是不安全的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用代码接收(bdd)进行测试,但是给出了错误

I 'm using codeception (bdd) making test but gives error

[Exception]                                                                                                
  DateTime::__construct(): 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.

我们选择欧洲/赫尔辛基进行 EEST / 3.0 / DST 代替;

我可以做什么?

推荐答案

您可以在运行此代码之前,先使用 date_default_timezone_set('Europe / Istanbul');

You can use date_default_timezone_set('Europe/Istanbul'); before running this code.

对于其他时区,请检查 PHP时区

For other timezones, check PHP Timezones

这篇关于`[Exception] DateTime :: __ construct():`依靠系统的时区设置是不安全的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆