strftime()函数显示不正确的时间 [英] strftime() function showing incorrect time

查看:1176
本文介绍了strftime()函数显示不正确的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

php中的 strftime()函数没有在我的系统上显示正确的时间。我在xampp上运行php。它在我的PC时钟的11点左右,但是当我执行以下代码时,函数 strftime()返回19: -

The strftime() function in php is not showing the correct time on my system. I am running php on xampp. Its around 11 o'clock on my PC clock, but the function strftime() returns 19 when I execute the following code:-

echo 'Time is - '.strftime('%H');


推荐答案

您可以通过执行ini_set在上面:

You can change your servers time zone by executing an ini_set at the top:

ini_set('date.timezone','Europe / Berlin');

如果您使用的是托管帐户,则服务器可能与您的时区不同。即使你在本地运行某些东西,我通常也会发现它的设置不同。

If you're on a hosting account the server is likely in a different time zone than you are. Even if you're running something locally I usually find it's set differently.

http://us3.php.net/timezones

这篇关于strftime()函数显示不正确的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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