devwiki:php

This is an old revision of the document!


PHP and SQL

  • select today data entry
    where DATE(`time_entry`) = CURDATE()
  • select current week data entry
    where  WEEKOFYEAR(`time_entry`) = WEEKOFYEAR(NOW());
  • select current month data entry
    where YEAR(`time_entry`) = YEAR(NOW()) AND MONTH(`time_entry`)=MONTH(NOW());
  • select past 24 hr
    where `time_entry`> DATE_SUB(NOW(), INTERVAL 1 DAY)
  • select past 7 days
    where `time_entry`> DATE_SUB(NOW(), INTERVAL 1 WEEK)
  • select past 1 month time
    where `time_entry`> DATE_SUB(NOW(), INTERVAL 1 MONTH)
  • devwiki/php.1623680143.txt.gz
  • Last modified: 2021/06/14 14:15
  • by ying