PHP从哪里获得DATE信息? [英] Where does PHP get it's DATE information from?
问题描述
我住在英国,当前时间是2014年2月10日,星期一,02:30am,但是,我的网站显示的时间是2014年2月9日,星期日,02:30am-日期和日期与午夜之前相同,所以我假设时区差异.我可以将其设置为我自己的时区吗?
I live in the UK and the current time is 02:30am on Monday 10th Feb 2014, however, my website is showing 02:30am Sunday 9th Feb 2014 - the day and date where the same before midnight so i am assuming a timezone difference. Can i set this to my own timezone ?
我可以将其设置为用户的时区吗?
edit: Can i set this to the users' timezone?
推荐答案
自日期算起整整24小时以来,这似乎不像是时区问题.但是以防万一,它是在您的php.ini中设置的,而其中未设置的,则默认为服务器时区.
That doesn't look like a timezone issue since the date if off by a full 24 hours. But just in case it is, it is set in your php.ini, and of that is not set, it defaults to the server time zone.
You can set it in your php.ini file by setting date.timezone
to be the timezone of your choosing.
date.timezone = Europe/London;
If you don't have access to the php.ini you can use date_default_timezone_set
to set the timezone in your scripts.
date_default_timezone_set('Europe/London');
这篇关于PHP从哪里获得DATE信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!