MySQL获取当前日期时间前几天0点 我超怕的- https://www.cnblogs.com/iAmSoScArEd/p/13614058.html
1、获取当前日期的00点
select timestamp(date_add(curdate(), interval - 0 day));
+--------------------------------------------------+
| timestamp(date_add(curdate(), interval - 0 day)) |
+--------------------------------------------------+
| 2020-09-04 00:00:00 |
+--------------------------------------------------+
2、获取当前时间的后一天(明天) 00点
select timestamp(date_add(curdate(), interval + 1 day));
+--------------------------------------------------+
| timestamp(date_add(curdate(), interval + 1 day)) |
+--------------------------------------------------+
| 2020-09-05 00:00:00 |
+--------------------------------------------------+
3、获取当前日期时间的前一天(昨天)00点
select timestamp(date_add(curdate(), interval - 1 day));
+--------------------------------------------------+
| timestamp(date_add(curdate(), interval - 1 day)) |
+--------------------------------------------------+
| 2020-09-03 00:00:00 |
+--------------------------------------------------+
4、获取本月1号的00点
select timestamp(date_add(curdate(), interval - day(curdate()) + 1 day));