MySQL Current_date and Current_date() are the Date Functions, which are used to return the current date value in YYYY-MM-DD or YYYYMMDD format. In this article, we will show you, How to get Current date in MySQL with example.
MySQL CURRENT_DATE Syntax
The basic syntax of the Current date in MySQL is as shown below:
TIP: Both these functions are the synonym of CURDATE(). All of them writers the same output.
MySQL CURRENT_DATE Example
The below query will show you the basic use of this current date function.
As you can see, it is showing today’s date in YYYY-MM-DD format.
The MySQL current Date function is a synonym for CURDATE(). Let me show you an example with all these three functions curdate(), current_date(), and current_date.
SELECT CURDATE() ;
The following query will show you, what happens when add days to the current_date(), current_date, and curdate functions.
SELECT CURRENT_DATE() + 3;
SELECT CURRENT_DATE + 3;
SELECT CURDATE() + 3;
From the above image, they added those days to current date. Next, they are displaying the date in YYYYMMDD string format
MySQL Current Date Example 2
In this example, we will show you, how to use these functions as an argument of another function.
This query finds the Day number from current date
Similarly, below query finds the Month Number and Year Number from Current Date in MySQL
Thank You for Visiting Our Blog