Skip to content

Instantly share code, notes, and snippets.

@Alxandr
Created June 27, 2012 06:28
Show Gist options
  • Save Alxandr/3001946 to your computer and use it in GitHub Desktop.
Save Alxandr/3001946 to your computer and use it in GitHub Desktop.
Showing dates in Filemanager
// Converts UNIX timestamps to dates.
var formatDate = function(date){
function add0(n, l) {
var str = n.toString();
while(str.length < l)
str = 0 + str;
return str;
}
var n = parseInt(date);
var d = new Date(n * 1000);
return add0(d.getDate(), 2) + "." + add0(d.getMonth() + 1, 2) + "." + d.getFullYear() + " " + add0(d.getHours(), 2) + ":" + add0(d.getMinutes(), 2);
}
///////////////////////////////////////
/* Inside the getFolderInfo function */
///////////////////////////////////////
if(props['Date Modified'] && props['Date Modified'] != ''){
result += '<td><abbr title="' + props['Date Modified'] + '">' + formatDate(props['Date Modified']) + '</abbr></td>';
} else {
result += '<td></td>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment