🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## year,month,day ### 说明 | 函数 | 说明 | | --- | --- | | year(date) | 返回日期date的年份(1000~9999) | | month(date) | 返回日期date的月份(1-12) | | day(date) | 返回日期date的号数(1-31) | ### 例子:查询宝宝月龄 ```sql SELECT id, baby_name, baby_birthday, (YEAR (now()) - YEAR (baby_birthday)) * 12 + (MONTH (now()) - MONTH (baby_birthday)) AS baby_monthage FROM baby; ```