Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 9 of 9

This is a discussion on help with server time in the Shared & Semi-Dedicated forum
I logged into my power panel to change the time zone to -5 EST but continue to have some problems. Iam using a news system ...

  1. #1
    Loyal Client
    Join Date
    Apr 2006
    Posts
    48

    help with server time

    I logged into my power panel to change the time zone to -5 EST but continue to have some problems.

    Iam using a news system and i have implemented a date and time code, this one(D M d, Y g:i:s A) but the problem i get is I can never get the actual correct time to appear when I post the news.

    Is this server related?

  2. #2
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    What server are you on -- and what type of account?

    I've been on four different servers here, and they were all okay...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  3. #3
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Here you go: http://www.lenon.com/chase.php

    This is the code I used...
    PHP Code:
    <?php
    // For Chase
    $serverdate date("D M d, Y g:i:s A");
    print (
    "For Chase: &nbsp; <b>");
    print (
    "$serverdate");
    print (
    "</b> &nbsp; <p>");
    ?>
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  4. #4
    Loyal Client
    Join Date
    Apr 2006
    Posts
    48
    thats weird because when i clicked on it, it showed me the time but its an hour off from the time on my comp. I.E the link showed 6:30 but the time on my windowns bar is 7:30

  5. #5
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    That's 'server time'... Two hours difference from my local time!
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  6. #6
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    JPC is located in Houston, TX, which is in the US central time zone and the servers are set to reflect that. The code that you posted (which are parameters to the date command) only format the server's time, they don't adjust it.

    To adjust the time displayed with PHP you'd have to do something like this:
    PHP Code:
    $serverdate date('D M d, Y g:i:s A'time() + 3600
    In this code time() returns the current server time as Unix timestamp (equal to the number of seconds since midnight on Jan 1, 1970) and we add 3600 seconds (1 hour) from that number to get a new timestamp equal to the current time in the US eastern time zone. When you pass a timestamp as a second argument to date() it generates its display from that. With no second argument date() uses the server's current time.

    If you didn't write the code for the news script you are using it may be difficult to make this change. Many prebuilt apps include options that allow you to adjust the displayed time, so check for that. Otherwise you may have to do some code searching.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

  7. #7
    JPC Guru
    Join Date
    Mar 2005
    Posts
    361
    The correct and proper way is to set the correct timezone in PHP, thus ALL date/time functions will give the local time you want.

  8. #8
    Yeah, I know a LOT! Vin DSL's Avatar
    Join Date
    Mar 2003
    Location
    Arizona Uplands
    Posts
    10,775
    Bah!

    Look, there's a million ways to compute time!

    What is time?

    Answer: It's a way to measure the span between events!

    Right now -- as we 'speak' -- as you're reading this -- it's all hours of the day n' night, and all seasons of the year, somewhere on Earth -- at this very moment. So, what difference does it make?

    To my way of thinking, server time is as good as any!

    If the OPER doesn't *feel* this way, tell 'us' what you want to do, and 'we' can do it -- server time -- local time -- time down under -- GMT -- GMT minus local -- Julian -- whatever!

    It's all a mind **** anyway! Let 'us' know, and we'll go from there...
    DISCLAIMER Any resemblance between the views expressed above and those of the owners and operators of this system is purely coincidental. Any resemblance between these views and my own are non-deterministic. The existence of Vin DSL is questionable. The existence of views in the absence of anyone to hold them is problematic. The existence of the reader is left as an exercise in the second-order coefficient.

    No Guts, No Story! VinDSL © 2010

  9. #9
    Community Leader jason's Avatar
    Join Date
    Sep 2001
    Location
    Rochester, NY
    Posts
    6,003
    Quote Originally Posted by sehh
    The correct and proper way is to set the correct timezone in PHP, thus ALL date/time functions will give the local time you want.
    PHP 5 supports a date.timezone configuration directive that allows you to control the timezone for your account/site/script automatically. Unfortunately it was introduced in PHP 5.1.0 and is not supported by any version of PHP 4. If you are on a PHP 4 server (as many of us are) you have no choice but to manually alter the timestamps that the server returns.

    --Jason
    Jason Pitoniak
    Interbrite Communications
    www.interbrite.com www.kodiakskorner.com

Bookmarks

Posting Permissions

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