Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003
    Posts
    2

    Unanswered: How do I change TimeStamp from US Eastern server time to GMT time on Database insert

    Hello,

    I am based in the UK. My hosting company is based in the US. I am using a MySql database. All the database tables have timestamps that are set to the local machine time. When I insert information the timestamp is automatically allocated to Eastern time

    I would like to change the timestamp so that it is a GMT on insert.

    Can you please tell me how I would go about doing this?

    Is their any code available to enable me to insert the timestamp as a GMT date or do I set the value from the mysql database end.

    Thanks

    Andrew

  2. #2
    Join Date
    Jul 2003
    Posts
    35
    Hi Andrew,

    I don't believe there is any function in MYSQL (at the moment) to automatically convert a timestamp to GMT time on insert.

    A possible way to tackle this issue, if you can't change the MYSQL config file, is:

    INSERT INTO $myTable VALUES( DATE_ADD( NOW(), INTERVAL -3 HOUR));

    The problem with the above statement, is you need to know the hour adjustment to GMT from your server's time. If you know this, just replace -3 with the adjustment factor. Additionally, replace the NOW() value (which just inserts the current date) with any date/time value you want to insert.

    Cheers,
    Ash
    Last edited by asherh; 10-28-03 at 13:01.

Posting Permissions

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