js 根据输入的年龄自动计算距离今天 的年纪

根据日期自动获取多大
var birth = new Date(日期);
var today = new Date();
age = Math.floor((today-birth) / (365.25 * 24 * 60 * 60 * 1000))+" 岁 ";

posted @ 2021-08-23 20:14  热心居民  阅读(120)  评论(0)    收藏  举报