...

View Full Version : Need a "offset" for server time difference



Dodge
06-16-2006, 12:26 AM
Hi all,

I'm not a php programmer - I do well with the markup languages but that is the extent of it. Much respect to the folks that do the real programming! :)

For our site we use a "last modified" script (i'm attaching it here) to show the last time we updated our news. I used to use an ssi script directly from Apache that allowed for setting a time offset (we are actually an hour behind our server).

I recently had to find a php solution for this and finally found a little script but it doesn't have an offset feature. I wonder if one of you would be kind enough, if it's even possible, to add this feature to the script I'm attaching/posting?

I sure would appreciate it as I'm not having much luck finding a ready-made one out there.

Here is the script:


<?php

// Change to the name of the file
$last_modified = filemtime("index.php");

// Display the results
// eg. Last modified Monday, 27th October, 2003 @ 02:59pm
print "News Updated: " . date("D, F dS @ g:iA", $last_modified);

?>

If this is an unreasonable request I understand and thanks anyway. :)

Dodge

anarchy3200
06-16-2006, 12:39 AM
The following should work fine for what you want, if i have gone wrong in the direction of the offset then it is easy enough to change you can just edit the "-1 hour" to anything from +4 hours to -1 week, it is quite user friendly!



<?php

// Change to the name of the file
$last_modified = filemtime("index.php");
//Take away one hour from time as stored
$last_modified = strtotime("-1 hour",$last_modified);

// Display the results
// eg. Last modified Monday, 27th October, 2003 @ 02:59pm
print "News Updated: " . date("D, F dS @ g:iA", $last_modified);

?>

Dodge
06-16-2006, 09:29 AM
Excellent, anarchy3200!! Thank you so much - works perfectly. :)

Dodge



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum