Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Jan 2005
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need a "offset" for server time difference

    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:

    Code:
    <?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

  • #2
    Regular Coder anarchy3200's Avatar
    Join Date
    Mar 2003
    Location
    England
    Posts
    261
    Thanks
    0
    Thanked 1 Time in 1 Post
    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 Code:
    <?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);

    ?>
    Mike

  • #3
    New Coder
    Join Date
    Jan 2005
    Posts
    85
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Excellent, anarchy3200!! Thank you so much - works perfectly.

    Dodge


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •