随笔分类 -  JS 对时间的处理

摘要:formatSeconds: function(value) { let that = this; var chetheTime = parseInt(value); // value是时间戳 var timestamp = (new Date()).getTime(); var date3 = chetheTime - timestamp; //计算出相差天数 var days = Math.f 阅读全文
posted @ 2019-09-11 10:23 ThisCall 阅读(189) 评论(0) 推荐(0) 编辑
摘要:this.addMinutes(new Date(Date.parse("2018-03-29 11:55")),5) //计算后n分钟的时间 addMinutes:function (date, minutes){ minutes=parseInt(minutes); var interTimes 阅读全文
posted @ 2018-03-29 13:09 ThisCall 阅读(248) 评论(0) 推荐(0) 编辑
摘要:var curTime = new Date(); //2把字符串格式转换为日期类 var startTime = new Date(Date.parse("2018-3-28 16:44")); var endTime = new Date(Date.parse("2018-3-28 16:45" 阅读全文
posted @ 2018-03-28 16:51 ThisCall 阅读(1298) 评论(0) 推荐(0) 编辑
摘要:data: { weekdays:['','','','','','',''] }, onLoad: function (options) { let that = this; let now = new Date(); let today = now.getFullYear() + '-' + ( 阅读全文
posted @ 2018-03-27 16:59 ThisCall 阅读(590) 评论(0) 推荐(0) 编辑
摘要:var now = new Date(); let today = now.getFullYear() + '-' + (now.getMonth() + 1) + '-' + now.getDate();//2018-3-27 var nowDayOfWeek = now.getDay(); co 阅读全文
posted @ 2018-03-27 16:12 ThisCall 阅读(437) 评论(0) 推荐(0) 编辑
摘要:js文件 'use strict'; let choose_year = null, choose_month = null; const conf = { data: { hasEmptyGrid: false, showPicker: false }, onLoad() { const date 阅读全文
posted @ 2017-11-28 11:20 ThisCall 阅读(6519) 评论(0) 推荐(0) 编辑
摘要:// "2017/10/1 00:00" kaiShi: function (a) { var that = this; function nowTime() { var dateTime = new Date(); var timestamp = Date.parse(new Date()); v 阅读全文
posted @ 2017-11-04 10:26 ThisCall 阅读(2109) 评论(0) 推荐(1) 编辑
摘要:js中获取时间new date()的用法 获取时间: 1 var myDate = new Date();//获取系统当前时间 获取特定格式的时间: 1 myDate.getYear(); //获取当前年份(2位) 2 myDate.getFullYear(); //获取完整的年份(4位,1970- 阅读全文
posted @ 2017-11-04 10:24 ThisCall 阅读(32143) 评论(0) 推荐(0) 编辑