将new Date()数据转化为‘2019-07-01’格式 //时间 function formatDate(date) { var y = date.getFullYear(); ; m = m < ? ' + m : m; var d = date.getDate(); d = d < ? (' + d) : d; return y + '-' + m + '-' + d; }; var nowTime = new Date(); var ss = formatDate(nowTime…
1.js获取系统时间格式为YYYY-MM-DD HH:MM:SS 1 function curDateTime(){ 2 var d = new Date(); 3 var year = d.getYear(); 4 var month = d.getMonth()+1; 5 var date = d.getDate(); 6 var day = d.getDay(); 7 var hours = d.getHours(); 8 var minutes = d.getMinutes(); 9 v…
1.JS获取时间格式为“yyyy-MM-dd HH:mm:ss”的字符串 function getTimeStr(){ var myDate = new Date(); var year = myDate.getFullYear(); //获取完整的年份(4位,1970-????) var month = myDate.getMonth(); //获取当前月份(0-11,0代表1月) month = month > 9 ? month : "0"+month; var day =…