Template:24 h to 12 h
Appearance
This template converts a time from 24-hour to 12-hour format.
It accepts one optional unnamed parameter. If the parameter is absent or neither a valid time nor number, the template returns the UTC at the time the page was generated.
{{24 h to 12 h}}
→ 5:00 pm{{24 h to 12 h|foo}}
→ 5:00 pm
The parameter can be a plain hour.
{{24 h to 12 h|00}}
→ 12 midnight{{24 h to 12 h|0}}
→ 12 midnight{{24 h to 12 h|1}}
→ 1 am{{24 h to 12 h|2}}
→ 2 am{{24 h to 12 h|3}}
→ 3 am{{24 h to 12 h|10}}
→ 10 am{{24 h to 12 h|11}}
→ 11 am{{24 h to 12 h|12}}
→ 12 noon{{24 h to 12 h|13}}
→ 1 pm{{24 h to 12 h|14}}
→ 2 pm{{24 h to 12 h|20}}
→ 8 pm{{24 h to 12 h|21}}
→ 9 pm{{24 h to 12 h|22}}
→ 10 pm{{24 h to 12 h|23}}
→ 11 pm{{24 h to 12 h|24}}
→ 12 midnight
The parameter can be an hour and minutes.
{{24 h to 12 h|00:00}}
→ 12:00 midnight{{24 h to 12 h|0:00}}
→ 12:00 midnight{{24 h to 12 h|0:01}}
→ 12:01 am{{24 h to 12 h|0:12}}
→ 12:12 am{{24 h to 12 h|1:23}}
→ 1:23 am{{24 h to 12 h|4:30}}
→ 4:30 am{{24 h to 12 h|7:56}}
→ 7:56 am{{24 h to 12 h|12:00}}
→ 12:00 noon{{24 h to 12 h|15:10}}
→ 3:10 pm{{24 h to 12 h|16:52}}
→ 4:52 pm{{24 h to 12 h|23:59}}
→ 11:59 pm{{24 h to 12 h|24:00}}
→ 12:00 midnight
The parameter can be an hour, minutes and seconds.
{{24 h to 12 h|00:00:00}}
→ 12:00:00 midnight{{24 h to 12 h|0:00:00}}
→ 12:00:00 midnight{{24 h to 12 h|00:00:01}}
→ 12:00:01 am{{24 h to 12 h|4:10:14}}
→ 4:10:14 am{{24 h to 12 h|6:23:11}}
→ 6:23:11 am{{24 h to 12 h|7:57:57}}
→ 7:57:57 am{{24 h to 12 h|11:59:59}}
→ 11:59:59 am{{24 h to 12 h|12:00:00}}
→ 12:00:00 noon{{24 h to 12 h|12:00:01}}
→ 12:00:01 pm{{24 h to 12 h|13:13:13}}
→ 1:13:13 pm{{24 h to 12 h|21:12:21}}
→ 9:12:21 pm{{24 h to 12 h|23:59:59}}
→ 11:59:59 pm{{24 h to 12 h|24:00:00}}
→ 12:00:00 midnight{{24 h to 12 h|24:50:50}}
→ 12:50:50 am