Select all data from MySQL where date between two given dates

Here is the simple MySQL query to fetch data between given date range

See MySQL query



$f_date=$_REQUEST['f_date'];

$t_date=$_REQUEST['t_date'];

"SELECT * FROM sales WHERE  sales_invoice_date between '".date('Y-m-d',strtotime($f_date))."' and '".date('Y-m-d',strtotime($t_date))."' "

To Fetch all the sales data in the given date

"SELECT * FROM sales WHERE sales_invoice_date='".date('Y-m-d',strtotime($f_date))."'" 

To fetch Today’s Sales

SELECT * FROM sales WHERE STR_TO_DATE(sales_invoice_date , '%d-%m-%Y') = CURDATE()

Leave a Reply

Your email address will not be published. Required fields are marked *