javascript獲取當前時間
Temperature: 0 °C
var myDate = new Date();
//獲取當前年
var year=myDate.getFullYear();
//獲取當前月
var month=myDate.getMonth()+1;
//獲取當前日
var date=myDate.getDate();
var h=myDate.getHours(); //獲取當前時(0-23)
var m=myDate.getMinutes(); //獲取當前分(0-59)
if(m<10) m = '0' + m;
var s=myDate.getSeconds();
if(s<10) s = '0' + s;
var now=year+'-'+month+"-"+date+" "+h+':'+m+":"+s;
以上紀錄~