Code Snippet
Adjust Server Time
Sometimes the time set on your server isn't accurate to what your local time is. If you can't change it, you can adjust it yourself.
$today = date('Y-m-d-G');
$today = strftime("%Y-%m-%d-%H", strtotime("$today -5 hour"));If your server thought it was 12 midnight, but it was really 7 pm, this will roll the $today variable back five hours to be correct.
The preferred way for PHP5 and above is to use:
date_default_timezone_set('Europe/London');
A list of the possible values are here:
http://www.php.net/manual/en/timezones.php
Yep, definitely use date_default_timezone_set(‘mytimezone’);
earthlink only hosts php 5.0.5 and that time zone changing function is not available… =\
date_default_timezone_set
(PHP 5 >= 5.1.0)
thank you OP
Yes i also support to use date_default_timezone_set(‘Your Time Zone’);
If you have full control over your server then you can change php.ini to locate your timezone.
Thanks
DigWP
A book and blog co-authored by Jeff Starr and myself about the World's most popular publishing platform.
Quotes on Design
Design, like Art, can be an elusive word to define and an awfully fun thing to have opinions about.
HTML-Ipsum
One-click copy to clipboard access to Lorem Ipsum text that comes wrapped in a variety of HTML.
Bookshelf
Hey Chris, what books do you recommend? These, young fertile mind, these.