tags:

views:

32

answers:

2

Am looking for a way to store GMT timestamp in the table.

Currently I use something like UNIX_TIMESTAMP(NOW()). But this will depend on which server my script is installed. In order to make it server-time agnostic, I want to store it in GMT time. I do not have any control over the server settings (like my.inf).

Thank you for your time

A: 

There is no way to tell MySQL to connect to a time server.

On your client, you must connect to a machine which has the correct time and put that into the INSERT or UPDATE statement.

In practice, this doesn't work well. The best solution is to make sure that the server's time is correctly synchronized. Ask the admins to setup NTP. This will fix the issue at the source.

Aaron Digulla
I was looking for something similar to gmdate in php
Alec Smart
A: 

You can tell MySql to use a particular time zone MySql timezone doc

Mark