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

后端 未结 14 1642
刺人心
刺人心 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:51

    + PC.GetHour(datetime) > 11 ? "pm" : "am"
    

    For your example but there are better ways to format datetime.

提交回复
热议问题