(转)jquery获取当前日期和时间
function getnowtime() { var nowtime = new Date(); var year = nowtime.getFullYear(); var month = padleft0(nowtime.getMonth() + 1); var day = padleft0(nowtime.getDate()); var hour = padleft0(nowtime.getHours()); var minute = padleft0(nowtime.getMinutes()); var second = padleft0(nowtime.getSeconds()); var millisecond = nowtime.getMilliseconds(); millisecond = millisecond.toString().length == 1 ? "00" + millisecond : millisecond.toString().length == 2 ? "0" + millisecond : millisecond; return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second + "." + millisecond; } //补齐两位数 function padleft0(obj) { return obj.toString().replace(/^[0-9]{1}$/, "0" + obj); }
获取当前时间,格式 2018-06-05 10:00:00.000
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17