Reputation: 111
i want to convert utc time to ist time , im getting time like this. i want to remove "GMT+0530 (India Standard Time)"
Thu Jul 19 2018 18:06:14 GMT+0530 (India Standard Time)
Expected result
Jul 19 2018 18:06:14 or 19/7/2018 06:06 PM
sample data
2018-07-19T16:36:21.065Z
code
function UtcToIst(data) {
var dt = new Date(data);
return dt;
}
Upvotes: 0
Views: 1053
Reputation: 111
I achieved it in the following way. Please correct me, if I am wrong.
var data = '2018-07-19T16:36:21.065Z';
function UtcToIst(data) {
var dt = new Date(data);
return dt;
}
var updDate = UtcToIst(data).toLocaleDateString();
var updTime = UtcToIst(data).toLocaleTimeString();
var updDateTime = updDate + ", " + updTime;
console.log(updDateTime); // 7/19/2018, 9:36:21 AM
Upvotes: 2