0

Here is the HTML code.

<mat-form-field appearance="outline">
    <mat-label>Time From: </mat-label>
    <input matInput type="time" formControlName="start_time">
</mat-form-field>

And output after form submitted.

{
   start_time: "00:47"
}
IAfanasov
  • 4,775
  • 3
  • 27
  • 42
  • What is your expect output format? Convert `21:57` into `09:57 PM`? – namgold Aug 10 '21 at 06:31
  • 3
    Does this answer your question? [Javascript: convert 24-hour time-of-day string to 12-hour time with AM/PM and no timezone](https://stackoverflow.com/questions/13898423/javascript-convert-24-hour-time-of-day-string-to-12-hour-time-with-am-pm-and-no) – Keshav Bajaj Aug 10 '21 at 06:33

2 Answers2

2

You can use moment.js library to get AM/PM with input time.

moment(start_time,'hh:mm').format('hh:mm a')
Atif Zia
  • 777
  • 2
  • 11
  • 28
0

Use format from date-fns library, moment.js is deprecated