//$(document).ready(function(){
//get result
// Check correct time format and split into components
// If time format correct
time = time.slice(1); // Remove full string match value
time[5] = +time[0] < 12 ? "AM" : "PM"; // Set AM/PM
time[0] = +time[0] % 12 || 12; // Adjust hours
return time.join(""); // return adjusted time or original string