Get hour and minute ion-datetime

How to get only hour and minute in ion-datetime ?

<ion-datetime displayFormat="HH:mm" placeholder="00:00hs" [(ngModel)]="timePanel.timeOff"></ion-datetime>

this is result actualy
2020-07-22T13:41:52.438-03:00

1 Like

As far as i understand this The Output Format will be the same like the NgModel’s Input Format.

I use this Little process to get the Hours and Mins in Am or PM from ion-datetime

this.tm = "2020-09-02T21:12:45.833+01:00"; // Value from ion-datetime
let d = this.tm.split('T')[1];

  let m = d.split(':')[0];

  let n = d.split(':')[1];

  var AmOrPm = m >= 12 ? 'pm' : 'am';

  m = (m % 12) || 12;

  var tm = m + ":" + n + " " + AmOrPm;
//tm will now output  9:12 pm

this is my little Workaround to get Hours and Time from Ionic DateTime Picker