Skip to content

Instantly share code, notes, and snippets.

@h2ero
Created September 10, 2014 10:41
Show Gist options
  • Save h2ero/9443ec5321549994da01 to your computer and use it in GitHub Desktop.
Save h2ero/9443ec5321549994da01 to your computer and use it in GitHub Desktop.
$(function(){
var timeCol = ['creation_time','timestamp','payment_time', 'delivery_time','target_shipping_time'];
console.log(timeCol);
var ths = $('#right table tr:first th');
console.log(ths);
ths.each(function(index){
timeColElIndex = timeCol.indexOf($(this).text());
if(timeColElIndex !== -1){
$('#right table tr').each(function(){
var timeEl = $('td:eq('+index+')', $(this));
var time = timeEl.text();
var date = new Date(time*1000);
var dateTime = date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()+' '+date.getHours()+':'+date.getMinutes() +':'+ date.getSeconds();
$(timeEl).html('<a>'+dateTime+'</a>');
});
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment