MySQL: CURRENT_TIMESTAMP Function

  • Post author:
  • Post category:MySQL
  • Post comments:1 Comment
MySQL CURRENT_TIMESTAMP Function

In this guide, we will explain how to use the MySQL CURRENT_TIMESTAMP function with syntax and examples.

Description

The MySQL CURRENT_TIMESTAMP function returns the current date and time.

Syntax

The syntax for the CURRENT_TIMESTAMP function is:

CURRENT_TIMESTAMP( )

Parameters or Arguments

There are no parameters or arguments for the CURRENT_TIMESTAMP function.

Note

  • The CURRENT_TIMESTAMP function will return the current date as a ‘YYYY-MM-DD HH:MM:SS’ format, if used in a string context.
  • The CURRENT_TIMESTAMP function will return the current date as a YYYYMMDDHHMMSS format, if used in a numeric context in versions of MySQL prior to MySQL 4.1.13.
  • The CURRENT_TIMESTAMP function will return the current date as a YYYYMMDDHHMMSS.uuuuuu format, if used in a numeric context in versions of MySQL 4.1.13 and newer.
  • The CURRENT_TIMESTAMP, LOCALTIME, and LOCALTIMESTAMP functions are synonyms for the NOW function.

Applies To

The CURRENT_TIMESTAMP function can be used in the following versions :

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let’s look at some CURRENT_TIMESTAMP function examples and explore how to use the CURRENT_TIMESTAMP function .

For example:

mysql> SELECT CURRENT_TIMESTAMP();
Result: '2014-01-28 13:48:41'

mysql> SELECT CURRENT_TIMESTAMP() + 0;
Result: 20140128134841.000000

mysql> SELECT CURRENT_TIMESTAMP() + 1;
Result: 20140128134842.000000

Next Topic : Click Here

This Post Has One Comment

Leave a Reply