标签:条件 time() 时间 time 开始 sel from diff birt
mysql 年龄计算(根据生日字段)
year( from_days( datediff( now( ), birthdate))) //获取年龄 now() 当前时间,精确到秒 datediff(begindate,enddate):返回两日期之间相关的日数. from_days(days):从0000-00-00开始,根据传入的日数,返回一个日期; year(date):获取日期上的年
[条件查找年龄在18到30]
$map .= " AND year(from_days(datediff(now( ),MbBirthDay))) >=18 AND year(from_days(datediff(now( ),MbBirthDay))) <30 ";
YEAR(CURDATE())-YEAR(birthday)-(RIGHT(CURDATE(),5)<RIGHT(birthday,5)
SELECT NOW(),CURDATE(),CURTIME()
NOW() // 2012-10-12 16:25:43 CURDATE() //2012-10-12 CURTIME//16:12:45
right(CURDATE(),5)截取右边5个字段
标签:条件 time() 时间 time 开始 sel from diff birt
原文地址:http://www.cnblogs.com/xqschool/p/7452706.html