HTML code
<form novalidate [formGroup]="udpateObj">
<div class="form-group">
<label for="HDresolutionDate">Resolution Date:</label>
<input type="text" id="date" formControlName="DateP" ngbDatepicker
#d1="ngbDatepicker">
</div>
<form>
code in ts file
let dateVal = backendDate;// am getting date obj from backend and
this.udpateObj= new FormGroup({
DateP: new FormControl(dateVal)
});
I need to show the date which is coming from backend or selected from date picker in dd/mm/yyyy format.
You can use the date pipe like in this example:
or implement a custom pipe if selected date is not a Date Object. Find here example for custom pipe (using momentjs) applying the format passed in call or the default format 'HH:mm'