in reply to Getting "A.M." and "P.M." with localtime $time
Rather than asking us to do this for you, please show us how you are currently attempting to do it, so we can show you how to improve & correct your code.