Select last day of current year in MySQL?

MySQLMySQLi Database

In order to get last day of current year, you can use LAST_DAY() from MySQL. The syntax is as follows−

SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 12-MONTH(CURDATE()) MONTH));

Let us implement the above syntax to know the last day of current year−

mysql> SELECT LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 12-MONTH(CURDATE()) MONTH));

This will produce the following output −

+-------------------------------------------------------------------+
| LAST_DAY(DATE_ADD(CURDATE(), INTERVAL 12-MONTH(CURDATE()) MONTH)) |
+-------------------------------------------------------------------+
| 2019-12-31                                                        |
+-------------------------------------------------------------------+
1 row in set (0.00 sec)
raja
Published on 03-May-2019 11:33:12
Advertisements