//获得当前日期
// separator:分隔符;可传".","-","/","c"
function getDate(separator){
separator = separator || '-'
var nowDate = new Date();
var year = nowDate.getFullYear();
var month = nowDate.getMonth() + 1; //月份从0开始
var day = nowDate.getDate();
if(separator == "c"){
return year + '年' + month + '年' + day + '日' ;
}else{
return year + separator + month + separator + day ;
}
}
网友评论