The code in question is below:
public static string ChangePersianDate(DateTime dateTime)
{
System.Globalization.GregorianCalendar PC = new System.Globa
From: http://www.csharp-examples.net/string-format-datetime/
string.Format("{0:t tt}", datetime); // -> "P PM" or "A AM"
Here is an easier way you can write the time format (hh:mm:ss tt)
and display them separately if you wish.
string time = DateTime.Now.Hour.ToString("00") + ":" + DateTime.Now.Minute.ToString("00") + ":" + DateTime.Now.Second.ToString("00") + DateTime.Now.ToString(" tt");
or just simply:
DateTime.Now.ToString("hh:mm:ss tt")