Format Date time in AngularJS

后端 未结 13 1781
Happy的楠姐
Happy的楠姐 2020-11-30 22:00

How do I properly display the date and time in AngularJS?

The output below shows both the input and the output, with and without the AngularJS date filter:



        
13条回答
  •  长情又很酷
    2020-11-30 22:38

    Simplly if you want to output like "Jan 30, 2017 4:31:20 PM" then follow to simple step

    step1- Declare following variable in js controller

    $scope.current_time = new Date();
    

    step2- display in html page like

    {{current_time | date:'medium'}}

提交回复
热议问题