4

Updated at : {{res.updated_at}}

Value: {"updated_at":"2017-04-12T21:46:20Z"}

I need to change this 2017-04-12T21:46:20Z to 2017-04-12 21:46:20 by removing T and Z. Please help how to achieve this. The code is in angular js.

1
  • Try: d = "2017-04-12T21:46:20Z"; d=d.replace(/[T]/, ' ');d=d.replace(/[Z]/, ''); Commented May 9, 2017 at 8:07

3 Answers 3

5

Try to:

{{res.updated_at| date : 'yyyy-MM-dd HH:mm:ss'}}

Detail format at: https://docs.angularjs.org/api/ng/filter/date

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

Comments

1

I don't know if it's specific to angular, but this formatting pattern should work.

yyyy-MM-dd hh:mm:ss

This should format the date as 2017-04-12 21:46:20

Comments

-1
"2017-04-12T21:46:20Z".split("T").join(" ").split("Z").join("")

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.