If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > How do I change TimeStamp from US Eastern server time to GMT time on Database insert

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-12-03, 15:47
blazinvibes blazinvibes is offline
Registered User
 
Join Date: Oct 2003
Posts: 2
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
Reply With Quote
  #2 (permalink)  
Old 10-28-03, 11:56
asherh asherh is offline
Registered User
 
Join Date: Jul 2003
Posts: 34
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 12:01.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On