You could use a library like moments.js or in POJS
Moments.js
A 5.5kb javascript date library for parsing, validating, manipulating,
and formatting dates.
unixtime
Unix time, or POSIX time, is a system for describing instances in
time, defined as the number of seconds that have elapsed since
00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January
1970,[note 1] not counting leap seconds.[note 2] It is used widely in
Unix-like and many other operating systems and file formats. Due to
its handling of leap seconds, it is neither a linear representation of
time nor a true representation of UTC.[note 3] Unix time may be
checked on some Unix systems by typing date +%s on the command line.
Javascript Date object
Summary
Creates JavaScript Date instances which let you work with dates and
times.
Javascript
function padZero(number) {
if (number < 10) {
number = "0" + number;
}
return number;
}
function unixtime2YYMMDD(unixtime) {
var milliseconds = unixtime * 1000,
dateObject = new Date(milliseconds),
temp = [];
temp.push(dateObject.getUTCFullYear().toString().slice(2));
temp.push(padZero(dateObject.getUTCMonth() + 1));
temp.push(padZero(dateObject.getUTCDate()));
return temp.join("-");
}
console.log(unixtime2YYMMDD(1372069271));
Output
13-06-24
On jsfiddle