生日(DATE)
计算方法1:
YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5))
计算方法2:
year( from_days( datediff( now( ), birthdate))) now() 当前时间,精确到秒 datediff(begindate,enddate):返回两日期之间相关的日数. from_days(days):从0000-00-00开始,根据传入的日数,返回一个日期; year(date):获取日期上的年.
时间: 2024-10-27 18:37:53