I have a very low-tech solution to this problem that does not involve any custom formatting or coding, macros, etc.
Use the standard formatting for time; i.e., [$-en-US]h:mm:ss AM/PM;@
This will result in time format like this: 11:00:00 AM or 2:45:00 PM.
You can include seconds if you need them.)
Now format those cells where applicable so they go to the right rather than left or centered.
Next, create a solid square shape, and size it to hide the AM or PM.
Drag the square over the "AM" or "PM" and resize it so you don't see it.
Adapt the column or cell width as desired.
Once the square mask is in place, format the square with no outer line and change to fill style and color to match your cell color. In the attached image, you can see AM/PM. Next, I put a transparent, outlined mask over it. Then I remove the outline. Finally, I make it solid white like the rest of the cells. Then I copy and paste it over each AM and PM. Easy peasy. :)
Screenshot of transitioning from AM/PM showing to masked