Why the month in Angular date filter is capitalised?

1k views Asked by At

I'm afraid if this question doesn't fit in this context.I wanted to know why the month (MM) of date filter in Angular in-built date filter is capitalised while the date(dd) and year(yyyy) are written in small letters.It dosen't work if I apply mm to the filter.

Sample Code: <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>

Ref: Angular Date Filters

2

There are 2 answers

0
Rahul Tripathi On BEST ANSWER

Its is used to differentiate between months(MM) and minutes(mm).

Also as RGraham, has said, you will find that in most of the languages it is treated like that and more or less it has become a standard.

0
Furkan Omay On

It is to distinguish between month and minutes. It is actually a DateTime.

In your example, you can see that both capital MM and small mm exists:

yyyy-MM-dd HH:mm:ss

This way, you can even format it to show only minutes.

I modified the official example on AngularJS docs to get these results:

{{1288323623006 | date:'medium'}}: Oct 29, 2010 6:40:23 AM
{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}: 2010-10-29 06:40:23 +0300
{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}: 10/29/2010 at 6:40AM
{{1288323623006 | date:"MM mm GGGG}}: 10 40 Anno Domini

It is used in another languages too when you need to apply cultural / standard formatting.