Please how can I refresh a date in angular 4
I need to display dynamically the date in the web page.
This is my code:
import { Component } from '@angular/core';
import * as moment from "moment";
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'My First Angular application';
oneHourAgo: string = "";
EightHoursAgo: string = "";
constructor( ) {
}
curTime() {
let now = moment().format("YYYY-MM-DD HH:mm:ss");
return now;
}
}