I am trying to add a time offset (+1hr) to this script; can anybody help. The server that hosts this page is in another time zone.
<?php
$filename = 'weather1.txt';
if (file_exists($filename)) {
echo "Last Updated: " . date ("F d Y H:i:s.", filemtime($filename));
}
?>
I am takeing a time stamp off the file being uploaded so people looking at the web page can see if the file has been updated as it should be via FTP.
Time offset on timestamp
Moderator: General Moderators
Re: Time offset on timestamp
Code: Select all
$date = strtotime(date("F d Y H:i:s", strtotime($date_from)) . " +1 hour");
Re: Time offset on timestamp
The order of arguments is wrong there, and you don't need 2 calls to strtotime().susrisha wrote:Code: Select all
$date = strtotime(date("F d Y H:i:s", strtotime($date_from)) . " +1 hour");
Use this:
Code: Select all
$date = date("F d Y H:i:s",strtotime('+1 hour', filemtime($filename)));Real programmers don't comment their code. If it was hard to write, it should be hard to understand.