How do I get the AM/PM value from a DateTime?

后端 未结 14 1660
刺人心
刺人心 2020-11-28 06:23

The code in question is below:

public static string ChangePersianDate(DateTime dateTime)
{
    System.Globalization.GregorianCalendar PC = new System.Globa         


        
14条回答
  •  天命终不由人
    2020-11-28 06:43

    string.Format("{0:hh:mm:ss tt}", DateTime.Now)
    

    This should give you the string value of the time. tt should append the am/pm.

    You can also look at the related topic:

    How do you get the current time of day?

提交回复
热议问题