I am using ng bootstrap datepicker. I want to set date format in input tag.
This is my html code
<input (click)="d.toggle()" type="text" [formControl]="updateEventForm.controls['live_date']"
value="{{dispalyLiveDate | date: 'd/M/yy'}}" ngbDatepicker #d="ngbDatepicker">
Here {{dispalyLiveDate | date: 'd/M/yy'}}
is my default value, when select date then date format is convert to yyyy-M-dd
, i want this date format same as d/M/yy
I had read document and find method format(date: NgbDateStruct)
but don't know how to use it.
Is it possible to convert default date format direct into input tag(without convert into component) ?
If you have the date with whatever format, you can paint it in the format that interests you in the html using this:
where 'order.flight.date' is the object where the date is stored.
It is important for this not to fail that the format is not the same that we want to obtain in any case.
I have not found a way to format the date to the desired format before storing it without doing it manually:
The language i am using is Angular 5.
In ngx-bootstrap you can specify the format: