select date_sub(now(),interval 1 month)

/*上个月今天的当前时间( 时间戳 )*/

select UNIX_TIMESTAMP(date_sub(now(),interval 1 month))

/*上个月的第一天*/

select date_sub(date_sub(date_format(now(),'%y-%m-%d 08:00:00'),interval extract( day from now())-1 day),interval 1 month)

/*上个月的第一天(时间戳)*/

select UNIX_TIMESTAMP(date_sub(date_sub(date_format(now(),'%y-%m-%d 08:00:00'),interval extract( day from now())-1 day),interval 1 month))

/*上个月的第一天:*/

select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract(day from now())-1 day),interval 1 month)

/*上个月的最后一天:*/

select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract(day from now()) day),interval 0 month) as date

/*这个月的第一天:*/

select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract(day from now())-1 day),interval 0 month)

/*这个月的最后一天:*/

select date_sub(date_sub(date_format(now(),'%y-%m-%d'),interval extract(day from now()) day),interval -1 month) as date