function getnowtime() { var nowtime = new Date(); var year = nowtime.getFullYear(); var month = padleft0(nowtime.getMonth() + 1); var day = padleft0(nowtime.getDate()); var hour = padleft0(nowtime.getHours()); var minute = padleft0(nowtime.getMinutes()); var second = padleft0(nowtime.getSeconds()); var millisecond = nowtime.getMilliseconds(); millisecond = millisecond.toString().length == 1 ? "00" + millisecond : millisecond.toString().length == 2 ? "0" + millisecond : millisecond; return year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second; }
function formatDate(time) { var now = null; if(time.toString().length == 10){ now = new Date(time * 1000); }else{ now = new Date(time); } var year = now.getFullYear(); var month = now.getMonth(); var day = now.getDay(); return year + '-' + month + '-' +day; }