MySQL DATE() Function with examples

The MySQL DATE() function is a built-in function you use to extract just the date portion from a DATE or DATETIME value. Learn how to use the DATE() function in this blog post…

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

Image by MaeM from Pixabay

MySQL DATE() Function Syntax

The MySQL DATE() function accepts 1 argument and has a simple syntax:

DATE(date or datetime expression)

In this query on the Sakila database ‘category’ table, we can see using the DATE() with the ‘last_update’ column as the argument, returns just the date portion:

mysql> SELECT last_update, DATE(last_update)
    -> FROM category
    -> LIMIT 5;
+---------------------+-------------------+
| last_update         | DATE(last_update) |
+---------------------+-------------------+
| 2006-02-15 04:46:27 | 2006-02-15        |
| 2006-02-15 04:46:27 | 2006-02-15        |
| 2006-02-15 04:46:27 | 2006-02-15        |
| 2006-02-15 04:46:27 | 2006-02-15        |
| 2006-02-15 04:46:27 | 2006-02-15        |
+---------------------+-------------------+
5 rows in set (0.00 sec)

πŸ“° Get your brand, product, or service the attention it needs with affordable classified ad placement in the OpenLampTech newsletter. Thank you for your support!


Thank you for reading this post. Please share it with someone else who would enjoy it as well.




Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.

Disclaimer: The majority of examples in this post, are performed in a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Like always, just because you can do something doesn’t mean you should. My opinions are my own.

More ways I can help

Disclosure: Some of this blog post’s services and product links are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.


πŸ“° Get your brand, product, or service the attention it needs with affordable classified ad placement in the OpenLampTech newsletter. Thank you for your support!

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.