1

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.

Thanks a lot.

codingbbq
  • 4,049
  • 5
  • 35
  • 47
  • Do you care about timezone DST rules? – Steve Robillard Aug 28 '10 at 09:39
  • you should learn more about time zones. seems like you want to change the time based on another part of the world. – bcosca Aug 28 '10 at 09:40
  • Thanks for reply @steve and @stillstanding. My only requirement is that if the time is 7PM the day should change. Is it possible? Wil check timezone and learn more about it..thanks – codingbbq Aug 28 '10 at 09:59

1 Answers1

1

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

Community
  • 1
  • 1
Paul Dixon
  • 295,876
  • 54
  • 310
  • 348