📜  角度获取当前时间 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:00.048000             🧑  作者: Mango

代码示例1
import { Component } from '@angular/core';
@Component({
    selector: 'my-app',
    template: `{{ now }}`
})
export class AppComponent {
    public now: Date = new Date();

    constructor() {
        setInterval(() => {
          this.now = new Date();
        }, 1);
    }
}