How to get AM or PM from Date

I need to find if its AM or PM from Date object. How is that possible even if the system locale may be set as 12 hour or 24 hour format. Please help

Check the Hour. If it’s greater than or equal to 12, it’s PM.

But what if the system locale is set to 12 hour format

date.hour is always in 24 hours format.


ok that clears the doubt. Thanks for all the help