Name

UTC_TIMESTAMP()

Synopsis

UTC_TIMESTAMP()

This function returns the current UTC date and time in yyyy-mm-dd hh:mm:ss format. It will return the UTC date and time in a yyyymmddhhmmss format if it’s used as part of a numeric calculation. As a numeric, the microseconds are included in the results. This statement is available as of version 4.1.1 of MySQL. The parentheses are optional. Use UTC_TIME() is you want only the UTC time, and UTC_DATE() if you want only the UTC date. Here is an example:

SELECT UTC_TIMESTAMP( ),
UTC_TIMESTAMP( ) + 0 AS 'UTC_TIMESTAMP( ) Numeric';

+---------------------+--------------------------+
| UTC_TIMESTAMP( )    | UTC_TIMESTAMP( ) Numeric |
+---------------------+--------------------------+
| 2008-12-07 22:08:24 |    20081207220824.000000 | 
+---------------------+--------------------------+

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.