- 取生日和当前日期之前的天数除以一年的实际天数(365天5小时48分46秒),然后取整
floor(DATEDIFF(CURDATE(),@birthday)/365.2422)
SELECT TIMESTAMPDIFF(YEAR,@birthday,CURDATE())
floor(DATEDIFF(CURDATE(),@birthday)/365.2422)
SELECT TIMESTAMPDIFF(YEAR,@birthday,CURDATE())
本文标题:mysql计算年龄
本文链接:https://www.haomeiwen.com/subject/zwvujqtx.html
网友评论