js获取当前年月日-YYYYmmDD格式的实现代码

时间:2016-06-01    点击:349   

js获取当前年月日-YYYYmmDD格式的实现代码

var nowDate = new Date();
 var year = nowDate.getFullYear();
 var month = nowDate.getMonth() + 1 < 10 ? "0" + (nowDate.getMonth() + 1)
  : nowDate.getMonth() + 1;
 var day = nowDate.getDate() < 10 ? "0" + nowDate.getDate() : nowDate
  .getDate();
 var dateStr = year + "-" + month + "-" + day;

以上这篇js获取当前年月日-YYYYmmDD格式的实现代码就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持本站。

JS在onclientclick里如何控制onclick的执行
JS获取复选框的值,并传递到后台的实现方法
有关jQuery中parent()和siblings()的小问题
深入理解ECMAScript的几个关键语句
星期几的不同脚本写法(推荐)
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved