To avoid confusion, the correct way to express 12 o'clock is 12 noon or 12 midnight.
Alternatively, the 24-hour clock system may be used - 12:00 and 24:00 (or 00:00) respectively.
The abbreviation am stands for ante-meridiem (before the Sun has crossed the meridian line) and pm stands for post-meridiem (after the Sun has crossed the meridian line).
At 12 noon, the Sun is at its highest point in the sky and directly over the meridian. It is therefore neither 'ante' (am) nor 'post' (pm).