Parameters & Returns
Parameters
Returns
Quick Summary
Converts 12-hour time format with AM/PM to 24-hour format.
Takes hour12 (12-hour format hour 1-12), isPM (AM/PM flag: 1 for PM, 0 for AM).
Returns the 24-hour hour value (0-23).
Technical Exegesis...
Converts a 12-hour format hour (1-12) with AM/PM flag to 24-hour format (0-23). The isPM parameter should be 1 for PM hours, 0 for AM hours. Returns 0 if hour12 is outside the valid range (1-12).
Conversion rules: 12 AM becomes 0, 1-11 AM stay the same (1-11), 12 PM stays 12, 1-11 PM become 13-23. Returns the 24-hour hour value (0-23) or 0 on error. Useful for parsing 12-hour time input into 24-hour format for calculations.