CodeIgniter日期-错误的时间 [英] CodeIgniter date - wrong time
本文介绍了CodeIgniter日期-错误的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用:
date("d-m-Y h:i:s")
在我的控制器中,但是时间晚于实际时间。
例如,现在在我的国家/地区是01:02,日期返回20-06-2015 01:06:38。
in my controller, but the time is later than actual time. For example, now in my country it's 01:02, date return 20-06-2015 01:06:38.
如何解决? / p>
How to fix it?
推荐答案
第一步:
转到 config / config.php
并写
1st Step :
Go to config/config.php
and write
//specify your region
date_default_timezone_set('Europe/Warsaw');
第二步:现在您可以利用时间
2nd step: now you can use your time
date("d-m-Y h:i:s") //for 21/12/2010 20:12:00
date("h:i:s") //for 12:12:11 time only
这篇关于CodeIgniter日期-错误的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文