Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Remainder operator solution in Clear category for Time Converter (24h to 12h) by flytaly
function timeConverter(dayTime: string) {
const [hours, minutes] = dayTime.split(':');
const period = +hours >= 12 ? 'p.m.' : 'a.m.';
const hNum = +hours % 12 || 12 ;
return `${hNum}:${minutes} ${period}`
}
May 16, 2020