Formats a date and time as a long string in the form "d MMM yyyy H:mm(:ss)" ie: 1 Oct 2010 9:45:04 with optional seconds.
public static string FormatDateTime(this DateTime dt,
bool showSec = true)
public static string FormatDateTime(this DateTime? dt,
bool showSec = true)
DateTime or DateTime? value to convert into the string format "d MMM yyyy H:mm(:ss)".
Optionally removes the seconds from the display to show only minutes in the format "d MMM yyyy H:mm" ie: 1 Oct 2010 9:45.
string now = DateTime.Now.FormatDateTime();