JS 时间转换时间戳 并做时间判断
来源:互联网 发布:js window 关闭事件 编辑:程序博客网 时间:2024/06/06 02:37
<script>function transdate(endTime){var date=new Date();date.setFullYear(endTime.substring(0,4));date.setMonth(endTime.substring(5,7)-1);date.setDate(endTime.substring(8,10));date.setHours(endTime.substring(11,13));date.setMinutes(endTime.substring(14,16));date.setSeconds(endTime.substring(17,19));return Date.parse(date)/1000;}//alert(transdate('2010-03-19 13:16'));//alert(transdate('2010-03-20 13:16'));Date.prototype.format = function(format){var o = {"M+" : this.getMonth()+1, //month"d+" : this.getDate(), //day"h+" : this.getHours(), //hour"m+" : this.getMinutes(), //minute"s+" : this.getSeconds(), //second"q+" : Math.floor((this.getMonth()+3)/3), //quarter"S" : this.getMilliseconds() //millisecond}if(/(y+)/.test(format)) {format = format.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));}for(var k in o) {if(new RegExp("("+ k +")").test(format)) {format = format.replace(RegExp.$1, RegExp.$1.length==1 ? o[k] : ("00"+ o[k]).substr((""+ o[k]).length));}}return format;}var now = new Date();var nowStr = now.format("yyyy-MM-dd hh:mm"); //获取系统当前时间alert(nowStr);alert(transdate(nowStr));</script>
0 0
- JS 时间转换时间戳 并做时间判断
- js 时间戳转换时间
- JS 时间转换时间
- js转换时间戳
- js 时间戳转换
- JS 时间转换为时间戳函数
- JS时间戳和时间之间转换
- Javascript、js 时间日期时间戳转换
- JS将时间戳转换时间格式
- JS 时间戳转换成时间格式
- js时间戳(时间格式转换)
- js 时间与时间戳的转换
- js 时间与时间戳的转换
- js将时间戳转换为时间
- js 时间与时间戳的转换
- 时间戳转换时间
- 时间戳转换时间
- jquery时间转换 时间戳转换 ,jquery 开始时间必须小于结束时间判断,jquery时间判断 。
- mmap函数和sysconf函数使用页偏移例子--linux函数
- 贪财的富翁
- 那些看不见的死锁
- PDF 解锁(unlock)
- 第六章 字符串
- JS 时间转换时间戳 并做时间判断
- 事务和两阶段提交,三阶段提交协议(有限状态自动机)
- 解决升级22.6新建Android项目后,src,layout目录下为空
- npm更换代理
- 应用系统安全认证-SSL安全通道
- codeforces 404B Marathon
- oracle在WINDOWS和UNIX(LINUX)下的主要区别
- 内核态和用户态区别
- 用消息队列和消息应用状态表来消除分布式事务