jsp中时间日期算法集合
来源:互联网 发布:海康域名注册平台 编辑:程序博客网 时间:2024/06/01 23:23
1. 计算 年龄相差18岁(如:1999-09-09 2006-01-01)
if(Math.abs((new Date(getBirthday(code)) - new Date(holderYear))/(1000*60*60*24*365)) < 18){
showMsg("相差不得少于18岁 ");
return false;
}
2. 计算年龄在18天到 多少岁 (天与年)
//计算周岁(起始为天)
var countZhouSui2 = function jsGetAge(strBirthday,startDay,endAge){
var thisTime = new Date().getTime();
if(Math.abs((thisTime - Date.parse(strBirthday)))/(1000*60*60*24) < startDay){
return false;
}
var now = new Date();
var endBirthday = new Date(now.getFullYear(),now.getMonth(),now.getDate());
endBirthday.setMonth(endBirthday.getMonth()-endAge*12);
endBirthday.setMonth(endBirthday.getMonth()-12);
endBirthday.setDate(endBirthday.getDate()+2);
if(Date.parse(strBirthday) < Date.parse(endBirthday)){
return false;
}
return true;
};
var countZhouSui2 = function jsGetAge(strBirthday,startDay,endAge){
var thisTime = new Date().getTime();
if(Math.abs((thisTime - Date.parse(strBirthday)))/(1000*60*60*24) < startDay){
return false;
}
var now = new Date();
var endBirthday = new Date(now.getFullYear(),now.getMonth(),now.getDate());
endBirthday.setMonth(endBirthday.getMonth()-endAge*12);
endBirthday.setMonth(endBirthday.getMonth()-12);
endBirthday.setDate(endBirthday.getDate()+2);
if(Date.parse(strBirthday) < Date.parse(endBirthday)){
return false;
}
return true;
};
//计算周岁(起始为天)
var countZhouSui2 = function jsGetAge(strBirthday,startDay,endAge){
var thisTime = new Date().getTime();
if(Math.abs((thisTime - Date.parse(strBirthday)))/(1000*60*60*24) < startDay){
return false;
}
var now = new Date();
var endBirthday = new Date(now.getFullYear(),now.getMonth(),now.getDate());
endBirthday.setMonth(endBirthday.getMonth()-endAge*12);
endBirthday.setMonth(endBirthday.getMonth()-12);
endBirthday.setDate(endBirthday.getDate()+2);
if(Date.parse(strBirthday) < Date.parse(endBirthday)){
return false;
}
return true;
};
var countZhouSui2 = function jsGetAge(strBirthday,startDay,endAge){
var thisTime = new Date().getTime();
if(Math.abs((thisTime - Date.parse(strBirthday)))/(1000*60*60*24) < startDay){
return false;
}
var now = new Date();
var endBirthday = new Date(now.getFullYear(),now.getMonth(),now.getDate());
endBirthday.setMonth(endBirthday.getMonth()-endAge*12);
endBirthday.setMonth(endBirthday.getMonth()-12);
endBirthday.setDate(endBirthday.getDate()+2);
if(Date.parse(strBirthday) < Date.parse(endBirthday)){
return false;
}
return true;
};
0 0
- jsp中时间日期算法集合
- JSP页面中获取当前日期时间
- mysql 中 时间和日期函数集合(1)【转】
- jsp 中关于日期时间处理的几个问题
- 在jsp页面中实现日期时间的显示
- 在JSP页面中获取当前日期时间
- 在JSP页面中获取当前日期时间
- 在JSP页面中获取当前日期时间
- 在JSP页面中获取系统当前日期时间
- sql日期时间处理集合
- JSP获取当前日期时间
- jsp日期与时间格式
- Java 常用的时间算法 返回时间集合 时间差 返回加N天后的日期 判断是否同一天
- java日期时间的处理方法集合
- 常用时间日期工具类集合
- jsp中把时间戳转化为常用的日期类型
- jsp页面显示日期 时间格式
- js实现jsp页面日期时间控件
- universal-image-loader 配置
- Apache多端口多目录配置方法
- 关于视图的生命周期
- Spark on Yarn可能遇到的问题
- C++ 虚函数表
- jsp中时间日期算法集合
- 爬虫技术做到哪些很酷很有趣很有用的事情
- POJ 1182 食物链(分层并查集)
- 去除AndroidStudio中libpng关于iCCP的警告
- 系统架构师所要了解的部分框架
- Java中什么是接口回调?
- ANDROID L - Material Design详解(视图和阴影)
- android 5.1 添加系统服务到framework,开机报错:SystemServer: java.lang.SecurityException
- Public Sub New() 与 form_load 有什么区别