How can I show correctly Dates yyyy-MM-dd hh:mm:ss with HTML5 and Angularjs?

前端 未结 2 737
我在风中等你
我在风中等你 2021-01-28 12:18

I\'m trying to create an input with date and time but I don\'t get the way of doing it.

I\'ve tried with input datetime,


  &         


        
2条回答
  •  逝去的感伤
    2021-01-28 13:08

    I recommend using the angular-moment directive for doing all date formatting in Angular: https://github.com/urish/angular-moment.

    Moment.js is a great JavaScript library for formatting, converting and doing all date/time related tasks - angular-moment just exposes this library easily within Angular.

    You can simply use the amDateFormat filter within your template as shown below.

    {{message.time | amDateFormat:'ffffdd, MMMM Do YYYY, h:mm:ss a'}}
    

    See the above link for more information.

提交回复
热议问题