date time format dd-MMM-yyyy HH:mm:ss C# code example
Example 1: c# datetime dd/mm/yyy hh:mm:ss
DateTime.Now.ToString("dd'/'MM'/'yyyy HH:mm:ss")
//output: 13/06/2020 13:05:21
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);
}