function fmtDate(obj){ var date = new Date(parseInt(obj.time,10)); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1; var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate(); var newTime = date.getFullYear() + "-" + month + "-" + currentDate; return newTime; }