Parse 12-Hour Time

A function that takes a number (1-12) and a string ('AM' or 'PM') and returns the equivalent 24-hour figure.

ParseTwelveHourTime(Hour, Meridiem)

function ParseTwelveHourTime(Hour, Meridiem)
if (Meridiem == 'AM') and (Hour == 12) then
Hour = 0
elseif (Meridiem == 'PM') and (Hour < 12) then
Hour = Hour + 12
end
return Hour
end