I am having problems with this script I made to convert the last modified date to my pacific timezone.
Here's the code:
// Specified time zone offset from web server. For my website,
// I am located on the west coast of the United States, and the
// server is located on the east coast of the United States. So
// the offset is -3 for me. But you must know the time zone of
// your web server.
$houroffset = "-3";
// Converts the hour offset so it is compatible with the PHP date
// statement. *** Nothing to be edited here ***
$timeadjust = ($houroffset * 60 * 60);
// Function for getting the last modified date and changing it to
// your time zone, and then printing it.
function last_modified($page_url)
{
// Gets the filename from the function. This filename must be
// Specified in the function though, or it **will not work!**
$filename = filemtime("/home/path/to/script".$page_url);
// Refer to [url]www.php.net/date[/url] for formatting the look of
// your date display. The current format(l, F j Y g:i:s A) will
// display as June 30 2005 11:41 AM
// Converts the last modified file date into a readable time
$modified_date = date("F j Y g:i A", $filename);
$modified_date = date("F j Y g:i A", $modified_date);
// Converts the readable time into specified time zone.
$modified_date = date("F j Y g:i A",time() + $timeadjust);
// Prints the modified date in your specified time zone
print $modified_date;
}
The server is located on the east coast, and when I wrote this script it wasnt the same. I originally intended this script to be just a current time script with time zones, but then I modified it to do this... But it isn't working. I would appreciate some help here.
Thanks in advance.
EDIT: Sorry about wrong section. Can someone please move it.