Kenzo
Kenzo

Reputation: 377

How to format date in Angular 4?

App using Angular 4 and bootstrap. I am using an input field that gets the date with month and year (type=month). But when the date saves, I am seeing "yyyy-mm" order. That is fine, but how can I switch the order in the client view to show mm-yyyy or even January 2018?

Upvotes: 0

Views: 106

Answers (1)

rrd
rrd

Reputation: 5977

You would use the date pipe structure:

{{ dateExpression | date: 'mm-dd-yyyy' }}

There is a good short page about it here that you can read and expand on.

Upvotes: 3

Related Questions