#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    I have written a guest book .php3
    and store the time of each message by using
    NOW().
    My Webhosting server has a time different
    -13 hours to my location.
    I just wonder is there any method which can:

    1) correct the time before the data write into MySQL DB, or

    2) correct the time before it displayed in
    the browser.

    I am using following functions to write and retreive time

    INSERT INTO MyGuestBook (message,time) VALUES ('$message', NOW());

    and

    $result = mysql_query_db ( ... ...);
    $row = mysql_fetch_object($result);
    echo $row->time;

    any expert here can provide a method to me
    for displaying the correct time?
    ps. i am using a web hosting server,
    i cannot modify the timezone in MySQL.


  2. #2
  3. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    19
    You can use the mysql adddate() function to add to the timestamp when you retrieve the data:

    query="select message,adddate(time,"INTERVAL 13 hour") as mod_time from MyGuestBook";
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2000
    Location
    Hong Kong
    Posts
    73
    Rep Power
    15
    yeah!
    thanks again Rod
    hehe

Similar Threads

  1. PHP isn't an Enterprise Solution
    By Zitan in forum PHP Development
    Replies: 54
    Last Post: July 18th, 2006, 09:24 PM
  2. UnixODBC + PHP + Apache + Empress
    By coder4hire in forum Database Management
    Replies: 0
    Last Post: January 15th, 2004, 01:41 PM
  3. Why Use ASP When There is PHP?
    By nintendong in forum ASP Programming
    Replies: 4
    Last Post: March 29th, 2003, 01:45 AM
  4. Understanding the php parameters with File upload.
    By rin in forum PHP Development
    Replies: 2
    Last Post: March 24th, 2003, 12:05 PM

IMN logo majestic logo threadwatch logo seochat tools logo