84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
比如传入'1991-6-3'返回true传递'2001-6-3'返回false
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
function getAge(dateString) { var today = new Date(); var birthDate = new Date(dateString); var age = today.getFullYear() - birthDate.getFullYear(); var m = today.getMonth() - birthDate.getMonth(); if (m < 0 || (m === 0 && today.getDate() < birthDate.getDate())) { age--; } return age > 18; } console.log(getAge('1997-11-09'))
function hasGrown(year, month = 1, day = 1) { // 默认为 1 月 1 日 // 获得 1970 年到 1988 年这 18 年的总时间 let age18 = new Date(1988, 0, 1).getTime(), now = new Date().getTime(), age = now - new Date(year, month - 1, day).getTime(); return age >= age18; }
<?php function check_age($start_time=0) { $time = time(); $age = $time - strtotime($start_time); if($age >= (18*365*24*60*60) ) { return true; } else { return false; } }
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...