function show(){
var mydate = new Date();
var str = "" + mydate.getFullYear() + "年";
str += (mydate.getMonth()+1) + "月";
str += mydate.getDate() + "日";
str+=mydate.getHours() + "時";
str+=mydate.getMinutes() + "分";
str+=mydate.getSeconds() + "秒";
return str;
}
function show1(){
function p(s) {
return s < 10 ? '0' + s: s;
}
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)
var s=myDate.getSeconds();
var now=year+'-'+p(month)+"-"+p(date)+" "+p(h)+':'+p(m)+":"+p(s);
return now;
}
將當前時間存到點擊的li里面去
點擊之后
兩種時間格式隨便用都可以