MySQL UTC_DATE is one of the Date Functions, which returns the current UTC date value in YYYY-MM-DD or YYYYMMDD format. The syntax of the UTC date Function in MySQL is as shown below:
UTC_DATE;
UTC_DATE();
MySQL UTC_DATE Example
The following query shows you the basic use of this UTC date function.
SELECT UTC_DATE;
SELECT UTC_DATE();
2019-02-19
2019-02-19
As you can see from the above screenshot, both the statements are returning the same output. I mean, both of them are showing today’s UTC date in YYYY-MM-DD format. This Function example shows you what happens when adding days to this method.
SELECT UTC_DATE(), UTC_DATE() + 5;
As you can see, it has added those 5 days to the current dt and displays the MySQL UTC date in YYYYMMDD string format.
Example 2
In this example, we are using the DATEDIFF method to compare the date difference between the UTC and custom date.
SELECT DATEDIFF(UTC_DATE(), '2019-02-10');