CURRENT_TIMESTAMP( )

This MySQL function returns the current date and time in yyyy-mm-dd hh:mm:ss format.

Syntax

Below is the syntax for this command. Text within square brackets (i.e, [ and ] ) are optional. Choices are separated by bars (i.e, | ). Ellipses preceded by a comma indicates a repeating pattern. Ellipses before or after syntax are used to highlight a relevant except from the larger syntax. Text displayed in italic letters represent text that should be replaced with the specific names related to the database (e.g., column with the name of the column).

CURRENT_TIMESTAMP()

Explanation

This function returns the current date and time in yyyy-mm-dd hh:mm:ss format. It will return the time in a yyyymmddhhmmss format, as a numeric if it's used as part of a numeric calculation (see example). Parentheses aren't required. It's a synomym for NOW( ).

Examples

SELECT CURRENT_TIMESTAMP() AS Now,
CURRENT_TIMESTAMP() + 10000 AS 'Hour Later';

+---------------------+----------------+
| Now                 | Hour Later     |
+---------------------+----------------+
| 2008-01-12 16:41:47 | 20080112174147 |
+---------------------+----------------+

By adding 10000 to the current time, the hour is increased by 1 and the minutes and seconds by zero each, and the time is displayed in the second field without dashes. This is in line with the yyyymmddhhmmss format involved in numeric calculations, with the numbers right justified.