我收到一个ajax调用响应,其中以“ 2019-02-07T14:00:11.374 + 0530”格式获取日期时间。我要将其转换为Feb-07-2019 14:00。
我尝试如下,但它显示当前日期,而不是ajax响应日期。我如何转换来自Ajax响应的日期。我通过调用“ starttime”从ajax响应中获取日期时间
这是我的代码
function format(driver_data) {
var a = '';
var b = '';
var i;
var ps = new Date();
ps = ps.toDateString() + " " + ps.getHours() + ":" + ps.getMinutes();
console.log(ps)
for (i = 0; i < driver_data.length; i++) {
a = '<table class="table table-striped table-bordered table-hover"style="padding-left:0px;">' + '<thead> <tr> <th>Trip Id</th> <th>Name</th> <th>Source</th> <th>Destination</th> <th>Date/Time</th> </tr> </thead>' + '<tbody>';
b = b + '<tr>' +
'<td>' + driver_data[i].d_tripid + '</td>' +
'<td>' + driver_data[i].employeename + '</td>' +
'<td>' + driver_data[i].srclocation + '</td>' +
'<td>' + driver_data[i].destlocation + '</td>' +
'<td>' ps'</td>' +
'</tr>';
}
var final = a + b + '</tbody></table>';
return final;
}