private static string formatTime(DateTime dateValue, string format) { string timeFormatted = ""; if (dateValue != null) { timeFormatted = dateValue.Format(format); } return timeFormatted; }
public static string FormatTimeSpecific(DateTime dateValue, string formatString) { formatString = formatString.Replace(".", ":").Replace("-", ":").Replace(",", ":"); if (dateValue != null && (typeof(DateTime) == dateValue.GetType())) { return(dateValue.Format(formatString)); } else { return(""); } }