1. 程式人生 > >jq獲取當前系統時間

jq獲取當前系統時間

//格式:2018-10-08 16:21:25

var d = new Date();
var vYear = d.getFullYear()
var vMon = d.getMonth() + 1
var vDay = d.getDate();
var h = d.getHours(); 
var m = d.getMinutes(); 
var se = d.getSeconds(); 
s=vYear + "-" +(vMon<10 ? "0" + vMon : vMon) + "-" +(vDay<10 ? "0"+ vDay : vDay)+" "+(h<10 ? "0"+ h : h) + ":"+(m<10 ? "0" + m : m) + ":"+(se<10 ? "0" +se : se);