MYSQL自带函数计算给定的两个日期的间隔天数

#Method  One
 select to_days(now()) - to_days('20120512')  
#Method  Two
 select datediff(now(),'20120512') 
#Method Three
 select (datediff(curdate(), date(colunm_name1))- (select colunm_name2 from table_name2)) as o 
from table_name1 

 

你可能感兴趣的:(mysql)