c# date format yyyy-mm-dd code example
Example 1: c# date to string yyyy-mm-dd
var date_string = date.ToString("yyyy-MM-dd");
Example 2: csharp datetime string format
DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss")
Example 3: c# datetime format ymd
Use DateTime.Now.ToString("yyyy-MM-dd h:mm tt");
Example 4: 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);
}