The time 12 a.m. is also referred to as midnight, and 12 p.m. is referred to as noon. A good trick for remembering this is to think of 12:01 a.m. occurring during the night as well as the minute directly before it.
To avoid confusion, many countries and industries such as the medicine field use a 24-hour clock often referred to as "military time." With this system, midnight is 00:00 and noon is 12:00. This is useful because there is no need to distinguish between two times during the same day. A new day starts at exactly 12:00 a.m. or rather 00:00 hours.