js计算前三个月的时间精确到时分秒
2017-09-20 00:00
369 查看
从系统当前时间计算,前三个月的时间点精确到时分秒
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 begin=new Date(); begin.setMonth((new Date().getMonth()-3)); //var begintime= begin.format("yyyy-MM-dd 00:00:00");零点格式 var begintime= begin.format("yyyy-MM-dd hh:mm:ss"); $('#beginDate').val(begintime);
相关文章推荐
- js时间控件(精确到时分秒)--具有选择修改的功能
- js时间控件 精确到时分秒 内涵js下载地址 及input
- oracle中计算时间差,精确到时分秒
- JS 计算时间差 精确到 天/月/时/分/秒/毫秒
- 关于oracle-sql-时间区间查询精确到时分秒
- 修改phpcms后台中表单向导的列表信息,每个访客提交表单时间精确到时分秒
- C#时间差的计算,精确输出“年月天时分秒”
- HTML5 的日期和时间选择器-精确到时分秒
- java web从数据库中读取时间datetime类型的数据并精确到时分秒
- 获得文件的创建时间(精确到时分秒)
- oracle保存时间精确到时分秒
- C#计算两个时间的时间差,精确到年月日时分秒
- bootstrap datatimepicker 时间选择插件---精确到时分秒
- 【转载】C#时间差的计算,精确输出“年月天时分秒”
- 项目中筛选条件起始时间查询 1.精确到某一天 '2016-02-24'; 2.精确到时分秒 '2016-02-24 10:03:55'
- js浮点数精确计算函数(加,…
- 精确到时分秒的日历控件
- JS中用于精确计算的加减乘除方法
- 用js计算时间差,得到比较人性化的结果
- js获取时间精确到秒(年月日)