function formateDate(date,s,m){ //参数1:时间戳;参数2:年月日连接符;参数3:时分秒连接符
    year = date.getFullYear();
    month = date.getMonth()+1;
    day = date.getDate();
    hour = date.getHours();
    minute = date.getMinutes();
    second = date.getSeconds();
    return __date=year+s+month+s+day+s+' '+hour+m+minute+m+second;
};
let d = new Date();
let res=formateDate(d,'/',':');
console.log(res)

 

posted on 2017-05-03 09:54  yangh_martin  阅读(142)  评论(0编辑  收藏  举报