MySQL CURRENT_TIMESTAMP() Function

The CURRENT_TIMESTAMP() function in MySQL is a simple way to get the current date and time from the database server.



CURRENT_TIMESTAMP(): Definition and Usage

This function is frequently used in database applications to record timestamps, log events, or perform time-related calculations. The returned value can be either a string in 'YYYY-MM-DD HH:MM:SS' format or a numeric value representing the date and time.

Syntax

Syntax

CURRENT_TIMESTAMP()
      

Examples

Getting the Current Date and Time

This query returns the current timestamp from the MySQL server.

Syntax

SELECT CURRENT_TIMESTAMP();
      
Output

2024-10-27 10:30:00 (Example output; the actual time will vary)
      

Adding to the Current Timestamp

Adding 1 to the timestamp (this adds one day). The exact result depends on your MySQL server's settings for date/time arithmetic.

Syntax

SELECT CURRENT_TIMESTAMP() + 1;
      
Output

2024-10-28 10:30:00 (Example output; one day added to the current time)