I got a jQuery jTable in my website. In the jTable there is a field test which basically displays date and time. I want to display only the time. So, I have a function like this.
test:{
title:'test time',
display:function(data){
time = data.record.test; // getting from backend
var d = new Date(time);
console.log(d.getHours(),':',d.getMinutes(),':',d.getSeconds());
},
},
When I run the code, it works fine as expected in the console i.e. It prints the time like this and this is what I am looking for.
8 : 42 : 29
8 : 42 : 39
8 : 43 : 32
8 : 43 : 42
8 : 47 : 48
But when I use return instead of console.log it returns only the seconds, so only the seconds are shown in my jTable like this (29, 39, 32, 42, 48). So how can I return the time with HH:mm:ss in the same format to the jTable.
Thanks
I just used this to return multiple values
return[d.getHours(),':',d.getMinutes(),':',d.getSeconds()]