public static Object ConvertDatetimeDB(string tempData)//to database { string[] formats = { "dd/MM/yyyy h:m tt", "dd/MM/yyyy hh:mm tt", "dd/MM/yyyy H:mm", "dd/MM/yyyy HH:mm", "dd/MM/yyyy h:mm:ss tt", "dd/MM/yyyy hh:mm:ss tt", "dd/MM/yyyy H:mm:ss", "dd/MM/yyyy HH:mm:ss", "d/M/yyyy h:m tt", "d/M/yyyy hh:mm tt", "d/M/yyyy H:mm", "d/M/yyyy HH:mm", "d/M/yyyy h:mm:ss tt", "d/M/yyyy hh:mm:ss tt", "d/M/yyyy H:mm:ss", "d/M/yyyy HH:mm:ss", "dd/MM/yyyy", "d/M/yy h:m tt", "M/d/yy hh:mm tt", "M/d/yy H:mm", "M/d/yyyy HH:mm", "M/d/yy h:mm:ss tt", "M/d/yy hh:mm:ss tt", "M/d/yy H:mm:ss", "M/d/yy HH:mm:ss", "MM/dd/yy h:m tt", "MM/dd/yy hh:mm tt", "MM/dd/yy H:mm", "MM/dd/yy HH:mm", "MM/dd/yy h:mm:ss tt", "MM/dd/yy hh:mm:ss tt", "MM/dd/yy H:mm:ss", "MM/dd/yy HH:mm:ss", "dd/MM/yyyy", "d/M/yyyy", "M/d/yy", "MM/dd/yy" }; DateTime OutDateTime; string datetime; if (string.IsNullOrEmpty(tempData) || String.IsNullOrWhiteSpace(tempData)) { return(DBNull.Value); } else { foreach (string i in formats) { if (DateTime.TryParseExact(tempData, i, new CultureInfo("en-US"), DateTimeStyles.None, out OutDateTime)) { if (!i.ToLower().Contains("h")) { datetime = OutDateTime.ToString("yyyy-MMM-dd"); } else { datetime = OutDateTime.ToString("yyyy-MMM-dd HH:mm:ss"); } return(datetime); } } } return(DateTime.MinValue); }
public override int GetHashCode() { int hash = 1; if (Id != 0) { hash ^= Id.GetHashCode(); } if (Title.Length != 0) { hash ^= Title.GetHashCode(); } if (Content.Length != 0) { hash ^= Content.GetHashCode(); } hash ^= awards_.GetHashCode(); if (SenderId != 0) { hash ^= SenderId.GetHashCode(); } if (Sender.Length != 0) { hash ^= Sender.GetHashCode(); } if (CreateTime != 0L) { hash ^= CreateTime.GetHashCode(); } if (OutDateTime != 0L) { hash ^= OutDateTime.GetHashCode(); } if (HasAttachment != 0) { hash ^= HasAttachment.GetHashCode(); } if (MailStatus != 0) { hash ^= MailStatus.GetHashCode(); } return(hash); }