Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

UTC_TIMESTAMP()

Status
Not open for further replies.

simplyroberto

Programmer
Apr 15, 2005
5
IT
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top