3

i have date format getting from server in the following way,

"tranDate":"2015-11-29T18:30:00.000Z"

I tried to displaying the date in the view like this, but the date is showing - 30/11/2015(i.e it should be 29/11/2015).

<td>{{stmt.tranDate | date:'dd/MM/yyyy'}}</td> 

what could be the problem?

0

5 Answers 5

4

Your time is in Zulu time (Z in the end). Angular displays time in your local time.

Sign up to request clarification or add additional context in comments.

Comments

2

As of Angular 1.3 you can specify that you want the time to be interpreted in UTC.

<td>{{stmt.tranDate | date:'dd/MM/yyyy' : 'UTC'}}</td> 

Comments

2

Try this {{stmt.tranDate | date:"dd/MM/yyyy": 'UTC'}}

Comments

1

You can apply this format then you have the desired date .

$scope.datex="2015-11-29T18:30:00.000Z";
  <p>{{datex | date:'d/M/yyyy'}}</p>

Comments

1

You should try with moment.js and with tha angular-moment directive

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.