MySQL UTC_DATE Function

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 MySQL UTC date function.

SELECT UTC_DATE;

SELECT UTC_DATE();
MySQL UTC_DATE Function 2

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;
MySQL UTC_DATE Function 3

As you can see, it has added those 5 days to current dt and displaying the MySQL UTC date in YYYYMMDD string format

UTC_DATE Example 2

In this example, we are using DATEDIFF method to compare the date difference between the UTC and a custom date

SELECT DATEDIFF(UTC_DATE(), '2019-02-10');
MySQL UTC_DATE Function 4