In this guide, we will explain how to use the MySQL CURRENT_DATE function with syntax and examples.
Description
The MySQL CURRENT_DATE function returns the current date.
Syntax
The syntax for the CURRENT_DATE function in MySQL is:
CURRENT_DATE( )
Parameters or Arguments
There are no parameters or arguments for the CURRENT_DATE function.
Note
- The CURRENT_DATE function will return the current date as a ‘YYYY-MM-DD’ format, if used in a string context.
- The CURRENT_DATE 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 CURRENT_DATE 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_DATE function examples and explore how to use the CURRENT_DATE function.
For example:
mysql> SELECT CURRENT_DATE(); Result: '2014-01-28' mysql> SELECT CURRENT_DATE() + 0; Result: 20140128 mysql> SELECT CURRENT_DATE() + 1; Result: 20140129
Next Topic : Click Here
Pingback: MySQL: CURDATE Function | Adglob Infosystem Pvt Ltd