时间戳转日期格式

  作者:chrispy

function fmtDate(obj){ var date = new Date(obj); var y = 1900+date.getYear(); var m = "0"+(date.getMonth()+1); var d = "0"+date.getDate(); return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring

function fmtDate(obj){

    var date =  new Date(obj);

    var y = 1900+date.getYear();

    var m = "0"+(date.getMonth()+1);

    var d = "0"+date.getDate();

    return y+"-"+m.substring(m.length-2,m.length)+"-"+d.substring(d.length-2,d.length);

}

fmtDate(date)


有用  |  无用

猜你喜欢