0

I try to get this format with angular formatDate

"2019-01-01T00:00:00Z"

So I use this code

formatDate(
  '2019-01-01',
  'yyyy-MM-ddT00:00:00Z',
  'en-US'
)

The result is 2019-01-01T00:00:00+0200

Z is replaced by the zone. There is a valid way to make the format I need ?

3
  • Yes there most probably is. But what exactly do you want? What did you try? What didn't work? Please be more specific with your question Commented Jul 4, 2019 at 14:58
  • 1
    @cloned All what you say is wroten in my post. I don't understand your comment. Commented Jul 4, 2019 at 15:04
  • I'm sorry, maybe I misunderstood your question. Someone was able to solve it, for me it was not clear what you meant. That's why I was asking. Commented Jul 5, 2019 at 6:56

1 Answer 1

2

You have to escape Z as a string or it will be treated as per this

"yyyy-MM-ddT00:00:00\'Z\'"

formatDate(
  '2019-01-01',
  "yyyy-MM-ddT00:00:00\'Z\'",
  'en-US'
)
Sign up to request clarification or add additional context in comments.

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.