
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
MySQL query to retrieve current date from a list of dates
Let’s say the current date is −
2019-07-22
Let us first create a table −
mysql> create table DemoTable705 (ShippingDate datetime); Query OK, 0 rows affected (0.67 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable705 values('2019-01-21 23:59:00'); Query OK, 1 row affected (0.17 sec) mysql> insert into DemoTable705 values('2019-07-22 00:00:30'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable705 values('2019-07-21 12:01:30'); Query OK, 1 row affected (0.44 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable705;
This will produce the following output -
+---------------------+ | ShippingDate | +---------------------+ | 2019-01-21 23:59:00 | | 2019-07-22 00:00:30 | | 2019-07-21 12:01:30 | +---------------------+ 3 rows in set (0.00 sec)
Following is the query to retrieve current date from a list of dates −
mysql> select *from DemoTable705 where date(ShippingDate)=CURDATE();
This will produce the following output -
+---------------------+ | ShippingDate | +---------------------+ | 2019-07-22 00:00:30 | +---------------------+ 1 row in set (0.00 sec)
- Related Articles
- MySQL query to get the current date from the list of dates
- MySQL query to order and display difference between dates from the current date
- Select dates between current date and 3 months from the current date in MySQL?
- Get maximum date from a list of varchar dates in MySQL
- MySQL query to retrieve records from the part of a comma-separated list?
- Retrieve MIN and MAX date in a single MySQL query from a column with date values
- MySQL time period query to fetch date records from interval of 14 weeks from current date?
- MySQL query to select date >= current date - 3 weeks?
- MySQL query to get current datetime and only current date
- MySQL query to get the current date records wherein one of the columns displays current date
- Filter query by current date in MySQL
- MySQL query to insert current date plus specific time?
- MySQL query to get the dates between range of records displaying student’s Date of Birth?
- MySQL query to select date from timestamp?
- MySQL Query to convert from datetime to date?

Advertisements