Konwertuj na 24 -godzinny format JavaSript
// 12:05:23AM > 00:05:23, 11:05:23AM > 23:05:23
function timeConversion(s) {
const pad = (num)=>num.toString().padStart(2,0)
const [hour, minutes, seconds] = s.split(':').map(parseFloat)
return s.includes('AM')
? `${pad(hour % 12)}:${pad(minutes)}:${pad(seconds)}`
: `${pad((hour % 12) + 12 )}:${pad(minutes)}:${pad(seconds)}`;
}
Husnain Syed