public static String TimeFormat(System.DateTime date, TimeFormats format) { string thedate = string.Empty; try { switch (format) { case TimeFormats.Standard: thedate = date.ToString("h:mmtt"); break; case TimeFormats.SqlMilitary: thedate = date.ToString("HH:mm:ss"); break; case TimeFormats.Military: thedate = date.ToString("HH:mm"); break; default: thedate = date.ToString("h:mmtt"); break; } } catch {} return (thedate); }