Angular date parsing unexpected output

拜拜、爱过 提交于 2019-12-24 04:09:08

问题


I'm trying to display a date using the date action, but it's giving odd output.

{{ mydate | date:'mm/dd/yyyy' }}

The month seems to be inconsistent and incorrect. What's wrong here?


回答1:


You need to use MM to display the month:

{{ mydate | date:'MM/dd/yyyy' }}

From the documentation

'MM': Month in year, padded (01-12)
...
'mm': Minute in hour, padded (00-59)



回答2:


You need to use date:'MM/dd/yyy'

mm is for minutes, MM is for months



来源:https://stackoverflow.com/questions/27584890/angular-date-parsing-unexpected-output

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!