一
SELECT NOW();--带时分秒
返回 yyyy-mm-dd
--某月的第一天
SELECT DATE_ADD(str_to_date(DATE_FORMAT(NOW(),'%Y-%m-%d'),'%Y-%m-%d'),interval -day(NOW())+1 day)
--某月的最后一天
SELECT LAST_DAY(NOW());
--某天上个月的第一天
SELECT date_add(str_to_date(DATE_FORMAT(NOW(),'%Y-%m-%d'),'%Y-%m-%d')-day(str_to_date(DATE_FORMAT(NOW(),'%Y-%m-%d'),'%Y-%m-%d'))+1,interval -1 month)
--某天的上个月的最后一天
SELECT last_day(date_sub(NOW(),interval 1 month))
--某天下个月的第一天
SELECT DATE_ADD(str_to_date(DATE_FORMAT(NOW(),'%Y-%m-%d'),'%Y-%m-%d'),interval -day(NOW())+1 day)