• 获取当前日期:SELECT CURRENT_DATE
  • 获取当前日期和时间:SELECT NOW()
  • 获取一个月第一天:SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL DAYOFMONTH(CURDATE()) - 1 DAY), '%Y-%m-01')
  • 获取本周星期一:SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL DAYOFWEEK(CURDATE()) - 1 DAY), '%Y-%m-%d')
  • 获取一年第一天:SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL DAYOFYEAR(CURDATE()) - 1 DAY), '%Y-01-01')
  • 获取季度第一天:SELECT DATE_FORMAT(DATE_SUB(CURDATE(), INTERVAL QUARTER(CURDATE()) - 1 QUARTER), '%Y-%m-01')
  • 获取当天的半夜:SELECT DATE_FORMAT(CURDATE(), '%Y-%m-