Skip to navigation
How to get a php/mysqli result from one month with a datetime column
29.09.17
example: sum query the opencart orders from one month with parameter $year and $month "SELECT SUM(`total`) AS total FROM `oc_order` WHERE `date_modified` BETWEEN DATE_FORMAT(STR_TO_DATE('{$year}/{$month}/01', '%Y/%c/%d'),GET_FORMAT(DATETIME,'ISO')) AND DATE_FORMAT(DATE_ADD(STR_TO_DATE('{$year}/{$month}/01', '%Y/%c/%d\ '),INTERVAL 1 MONTH),GET_FORMAT(DATETIME,'ISO'))";
https://www.techonthenet.com/mysql/functions/date_add.php
Reply
Anonymous
Information Epoch 1740332496
Files are bags of bytes.
Home
Notebook
Contact us