27.03.2017 Views

ng-book

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Filters 38<br />

date<br />

The date filter allows us to format a date based upon a requested format style. The date formatter<br />

provides us several built-in options. If no date format is passed, then it defaults to showi<strong>ng</strong><br />

mediumDate (as you can see below).<br />

Here are the built-in localizable formats:<br />

{{ today | date:'medium' }} <br />

{{ today | date:'short' }} <br />

{{ today | date:'fullDate' }} <br />

{{ today | date:'lo<strong>ng</strong>Date' }} <br />

{{ today | date:'mediumDate' }} <br />

{{ today | date:'shortDate' }} <br />

{{ today | date:'mediumTime' }} <br />

{{ today | date:'shortTime' }} <br />

The date formatter also enables us to customize your date format to our own liki<strong>ng</strong>. We can combine<br />

and chain together these format options to create one si<strong>ng</strong>le date format, as well:<br />

Year Formatti<strong>ng</strong><br />

Four-digit year: {{ today | date:'yyyy' }} <br />

Two-digit padded year: {{ today | date:'yy' }} <br />

One-digit year: {{ today | date:'y' }} <br />

Month Formatti<strong>ng</strong><br />

Month in year: {{ today | date:'MMMM' }} <br />

Short month in year: {{ today | date:'MMM' }} <br />

Padded month in year: {{ today | date:'MM' }} <br />

Month in year: {{ today | date:'M' }} <br />

Day Formatti<strong>ng</strong><br />

Padded day in month: {{ today | date:'dd' }} <br />

Day in month: {{ today | date:'d' }} <br />

Day in week: {{ today | date:'EEEE' }} <br />

Short day in week: {{ today | date:'EEE' }} <br />

Hour Formatti<strong>ng</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!