以下是相关的代码:
public static string ChangePersianDate(DateTime dateTime)
{
System.Globalization.GregorianCalendar PC = new System.Globalization.GregorianCalendar();
PC.CalendarType = System.Globalization.GregorianCalendarTypes.USEnglish;
return
PC.GetYear(dateTime).ToString()
+ "/"
+ PC.GetMonth(dateTime).ToString()
+ "/"
+ PC.GetDayOfMonth(dateTime).ToString()
+ ""
+ PC.GetHour(dateTime).ToString()
+ ":"
+ PC.GetMinute(dateTime).ToString()
+ ":"
+ PC.GetSecond(dateTime).ToString()
+ " "
????????????????
}
如何从 dateTime
值中获取 AM/PM?
DateTime
的方法。请参见 http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx。 - ChrisFdateTime.ToString("tt");
。 - David Jesus