vishnu
vishnu

Reputation: 4599

angularjs convert date format to IST

I want to convert date from 2015-12-02T18:30:00.000+0000 to Wed Dec 02 2015 00:00:00 GMT+0530 (India Standard Time) using angularjs.

Upvotes: 0

Views: 3853

Answers (2)

Divya MV
Divya MV

Reputation: 2053

you can make use of angular's date filter . The formats are clearly given here

{{'2015-12-02T18:30:00.000+0000' | date:"EEE MMM dd yyyy HH:hh:ss 'GMT'Z '(India Standard Time)'"}}

The above code snippet will give you Thu Dec 03 2015 00:12:00 GMT+0530 (India Standard Time) in the output. that is the time when you calculate from +0000 to a +0530

Here is a working solution

Upvotes: 2

Khalid Hussain
Khalid Hussain

Reputation: 1694

Working fiddle

HTML:

<div ng:app ng:controller="Scoper">
    Input: {{v}}  <br />
    Angular: {{v | date:'EEE MMM dd yyyy HH:mm:ss'}} GMT{{v | date:'+0530' }} (India Standard Time) <br />

</div>

JS

function Scoper($scope) {
    var s = "2015-12-02T18:30:00.000+0000";
    $scope.v = s;
}

Upvotes: 0

Related Questions