simplyroberto
Programmer
Hello,
When I insert a new record in the database and I need to record a time, I usually do this:
INSERT INTO table1 (field1, time) VALUES ('string', NOW())
The problem with NOW() is that it returns the local time of the server, whereas I want the GMT
I understand that with MySQL5 you can use UTC_TIMESTAMP(), which returns the unix timestamp in date format ('YYYY-MM-DD HH:MM:SS') and therefore the GMT datetime. I have two questions:
1. Is this the best way to get the GMT datetime?
2. Will this function work in 2037 when the unix timestamp will overflow?
Many thanks,
Roberto
When I insert a new record in the database and I need to record a time, I usually do this:
INSERT INTO table1 (field1, time) VALUES ('string', NOW())
The problem with NOW() is that it returns the local time of the server, whereas I want the GMT
I understand that with MySQL5 you can use UTC_TIMESTAMP(), which returns the unix timestamp in date format ('YYYY-MM-DD HH:MM:SS') and therefore the GMT datetime. I have two questions:
1. Is this the best way to get the GMT datetime?
2. Will this function work in 2037 when the unix timestamp will overflow?
Many thanks,
Roberto