防沉迷判断岁数
2017-03-20 11:25:59
//---------------------------------------防沉迷----------------------------------
if($idcard = $passport_dao->get_user_idcard($passport['user_name']))
{
$card_num = count($idcard);
if($card_num == '15')
{
$now_date=date('y-m-d');//获取当前时间,10-08-02
$passport_idcard_date=substr($idcard,6,6);//$passport_idcard_date="1984-01-01";
}
if($card_num == '18')
{
$now_date=date('Y-m-d');//获取当前时间,如2010-08-02
$passport_idcard_date=substr($idcard,6,8);//$passport_idcard_date="1984-01-01";
}
$date = strtotime($now_date)-strtotime($passport_idcard_date);
$year=round(($date)/365/3600/24);
if($year>=18)
{
$fcm = 0;
}
else
{
$fcm=1;
}
}
else
{
$fcm = 1;
}
//---------------------------end防沉迷--------------------------
mysql 中时间语句mssql 学习过程 2009-03-24 15:43:30 阅读14 评论0 字号:大中小 订阅
计算两个时间月份差
1982-08-12 00:00
1980-08-12 00:00
TIMESTAMPDIFF(MONTH,field_date_value,field_date_value2)
计算两个时间年差
计算年龄:
DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(field_birth_date_value)), '%Y')+0
统计所有差的,工作经历所用
DATE_FORMAT(FROM_DAYS(sum((TO_DAYS(cte.field_date_value2)-TO_DAYS(cte.field_date_value)))), '%Y')+0
发表评论: