mysql获取上月的某一天

1、mysql获取上月的第26天

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

注:https://blog.csdn.net/winter13292/article/details/7888358

https://blog.csdn.net/qq_36387683/article/details/88650649

2、MySQL获取当前年份月份日期

select day('2020-08-27') -- 27

select YEAR(CURDATE());


select MONTH(CURDATE());

 

 
 
 
 
 

你可能感兴趣的:(mysql)