xxxxxxxxxx
import { Component, OnInit } from '@angular/core';
import { DatePipe } from '@angular/common';
@Component({
selector: 'app-your-component',
templateUrl: './your-component.component.html',
})
export class YourComponent implements OnInit {
currentDate: Date;
formattedDate: string;
constructor(private datePipe: DatePipe) { }
ngOnInit(): void {
this.currentDate = new Date(); // Assuming you want to format the current date
this.formattedDate = this.datePipe.transform(this.currentDate, 'dd/MM/yyyy');
}
}