Is there any way to get the AM or PM time in the morning or afternoon?

There is a way to store the values before and after 12:00 in Now, but is there a function to directly determine if it is AM or PM?

Hi @Kirigirisu_Coin,

The below c # code is used to get the AM or PM of the current time.



Can you try the following condition?


True : AM
False : PM



Please make use of the below code as in the inline screenshots.

Datetime.Now.ToString(“tt”) - this will simply return the value whether AM or PM.

DateTime AM 1

DateTime AM 3

Hope this will help you. Thank you.


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.