I have a JQuery function like this
function (){
alert($scope.modal.ondutytime);
var data = {
"OnDutyTime": $scope.modal.ondutytime,
"Comments": ""
};
alert(JSON.stringify(data));
}
The $scope
contains all the values which I set in angularJs view. The problem is that the first alert
shows local ondutytime
date & time as
Tue Oct 06 2015 20:30:44 GMT+0500 (Pakistan Standard Time)
but when I create a JSON object data
and then alert it after stringify, it shows UTC date & time (5 hours difference)
{
"OnDutyTime": "2015-10-06T15:33:10.903Z"
"comments":""
}
How can I ensure that it do not convert to GMT?
EDIT: I also tried this
new Date('2015-10-06T15:33:10.903Z')
it is showing me local date & time, however I have to supply it $scope.modal.ondutytime
which already contains my local date & time. So when I write the above line as
new Date($scope.modal.ondutytime)
it again shows UTC date & time.