js获取当前年月日

function GetDate(){

var now = new Date();

var year = now.getFullYear();         //年
var month = now.getMonth() + 1;     //月
var day = now.getDate();              //日
     
var hh = now.getHours();              //时
var mm = now.getMinutes();             //分

}

你可能感兴趣的:(js)