The server is sending a string in this format: 18:00:00. This is a time-of-day value independent of any date. How to convert it to 6:00PM in Javasc
18:00:00
6:00PM
function timeConversion(s) { let hour = parseInt(s.substring(0,2)); hour = s.indexOf('AM') > - 1 && hour === 12 ? '00' : hour; hour = s.indexOf('PM') > - 1 && hour !== 12 ? hour + 12 : hour; hour = hour < 10 && hour > 0 ? '0'+hour : hour; return hour + s.substring(2,8); }