showing results for - "convert string in hh 3amm am 2fpm to date js"
Kimberley
02 Feb 2020
1var input   = '10:23 PM',
2    matches = input.toLowerCase().match(/(\d{1,2}):(\d{2}) ([ap]m)/),
3    output  = (parseInt(matches[1]) + (matches[3] == 'pm' ? 12 : 0)) + ':' + matches[2] + ':00';
4
5console.log(output); // 22:23:00 
6