获取时间

来源:互联网 发布:海信网络电视好吗 编辑:程序博客网 时间:2024/05/17 22:58
/** * 得到当前日期 * @returns {String} */
function getNowFormatDate() {    var date = new Date();    var seperator1 = "-";    var month = date.getMonth() + 1;    var strDate = date.getDate();    if (month >= 1 && month <= 9) {        month = "0" + month;    }    if (strDate >= 0 && strDate <= 9) {        strDate = "0" + strDate;    }    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate    return currentdate;}

0 0