开发者

Php change date with respect to specified time

开发者 https://www.devze.com 2023-01-13 18:03 出处:网络
I have this question. I am using php, mysql and my files will be hosted on linux machine. Is it possible to change the date on a different format. I mean the date should change if it is 5PM. That is

I have this question.

I am using php, mysql and my files will be hosted on linux machine.

Is it possible to change the date on a different format. I mean the date should change if it is 5PM. That is if today is 28th august 2010, then after 5pm it should show 29th august 2010.

开发者_如何学GoThanks a lot.


Sounds like you simply want to add 7 hours to current time?

$corrected=time() + 3600*7;
echo strftime("%d %B %Y", $corrected);

If you want to do this for all your code, take a look at the PHP time zone configuration and date_default_timezone_set()

If you want to set your timezone on a server-wide basis, you'll probably find plenty of answers on ServerFault.com, such as Setting time zone on Linux (ubuntu)

See also

  • PHP ini date.timezone? Server or client location time zone?
  • PHP, how to set timezone??
  • Dealing with timezones in PHP
0

精彩评论

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