TIL that AM and PM (short for the latin ante meridiem and post meridiem) are styled lowercase with a preceding space and punctuation in most style guides “10:10 a.m.” or “6 p.m.” rather than uppercase. Or if the style is upper case, small caps are recommended with no punctuation such as “10:10 ᴀᴍ” or “6 ᴘᴍ”.
I always thought uppercase was the formally correct way! Good news is that it varies enough that you can basically do whatever you like. If I show up late, it’s definitely not because someone typed “Meet at 6pm”.