The following is a simple method to set your timezone within PHP. You need to do this at the start of each of your pages. If your using OOP (Object-Oriented Programming) in PHP then put this in one of your main objects. Otherwise just include the line at the start of each file. If thats not possible, just include it at the top of any file that uses the built in date or time functions.
<?php
echo "Original Time: ". date("h:i:s") ."n";
date_default_timezone_set("Europe/London");
echo "New Time: ". date("h:i:s") ."n";
?>

As you can see, you need to use the date_default_timezone_set() function along with a timezone identified.

You can find a list of valid timezones at http://uk2.php.net/manual/en/timezones.php

Posted by epic at 16:03pm

No comments yet. Be the first to add one!


Leave a Reply