Unanswered: How do I change TimeStamp from US Eastern server time to GMT time on Database insert
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.
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.