1
0
Fork 0
empact/app/scripts/date.js

20 lines
423 B
JavaScript
Raw Normal View History

2015-03-16 18:02:53 +00:00
var monthNames = [
'Jan', 'Feb', 'Mar',
'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'
];
function formatDate(ts, showYear) {
var d = new Date(ts*1000),
day = d.getDate(),
month = monthNames[d.getMonth()],
year = (''+ d.getFullYear()).slice(2);
if (showYear) {
return month +' '+ day +" '"+ year;
} else {
return month +' '+ day;
}
}