fixed parsing of times in 12-hour format

In 12-hour format, 12:xx is an exception:
12:xx AM -> 00:xx and 12:xx PM -> 12:xx