c# format date mm/dd/yyyy code example
Example 1: csharp datetime string format
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
Example 2: c# date string format yyyy-mm-dd
public static string FORMAT_PDF = "dd/MM/yyyy";
public static string convertDateTimeFormatByStrDate(string strDate,string format)
{
DateTime temp = Convert.ToDateTime(strDate);
return temp.ToString(format);
}