Midnight – and noon – aren’t defined as a.m. or p.m. You can talk about 12:01 a.m., and you can talk about 12:01 p.m., but 12 o’clock a.m. and 12 o’clock p.m. mean different things to different people. It’s better to say noon or midnight.
Also, if you wonder whether tonight’s midnight really belong to tonight – or to tomorrow morning: astronomers and the military use a system in which midnight is 0 hours. In that system, tonight’s midnight is the first moment of tomorrow. But as for the rest of us – there’s no official answer. That’s why airlines always schedule flights for 11:59 p.m. or 12:01 a.m. – never midnight.