Sample Header Ad - 728x90

MySQL Set UTC time as default timestamp

50 votes
6 answers
173083 views
How do I set a timestamp column whose default value is the current UTC time? MySQL uses UTC_TIMESTAMP() function for UTC timestamp: mysql> SELECT UTC_TIMESTAMP(); +---------------------+ | UTC_TIMESTAMP() | +---------------------+ | 2012-07-01 11:36:35 | +---------------------+ 1 row in set (0.00 sec) So I've tried: CREATE TABLE blah ( creation_time TIMESTAMP DEFAULT UTC_TIMESTAMP, ... And other variations, like UTC_TIMESTAMP(), but without success.
Asked by Adam Matan (12079 rep)
Jul 1, 2012, 11:33 AM
Last activity: Feb 20, 2023, 01:48 PM