How to get Current Date time

前端 未结 5 696
日久生厌
日久生厌 2021-01-11 13:06

How can I get current date and time in angularjs

I have tried the following:

{{Date.Now}}

But it d

5条回答
  •  天涯浪人
    2021-01-11 13:34

    In Component file:

    this.registerDate = new Date().toJSON("yyyy/MM/dd HH:mm");
    this.updateDate = new Date().toJSON("yyyy/MM/dd HH:mm");
    

    In Template file:

    {{registerDate}}
    {{updateDate}}
    

    Result will return:

提交回复
热议问题