Mysql Curdate Function

MySQL: CURDATE Function

This tutorial explains how to use the MySQL CURDATE function with syntax and examples.

Description

The MySQL CURDATE function returns the current date.

Syntax

The syntax for the CURDATE function in MySQL is:

CURDATE( )

Parameters or Arguments

There are no parameters or arguments for the CURDATE function.

Note

  • The CURDATE function will return the current date as a 'YYYY-MM-DD' format, if used in a string context.
  • The CURDATE function will return the current date as a YYYYMMDD format, if used in a numeric context.
  • The CURRENT_DATE function is a synonym for the CURDATE function.

Applies To

The CURDATE function can be used in the following versions of MySQL:

  • 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 MySQL CURDATE function examples and explore how to use the CURDATE function in MySQL.

For example:

mysql> SELECT CURDATE();
Output: '2014-01-28'

mysql> SELECT CURDATE() + 0;
Output: 20140128

mysql> SELECT CURDATE() + 1;
Output: 20140129