DeadByDaylightBackup.Utility/DateUtility.cs
/// <summary>
/// Convert String in short format to DateTime
/// </summary>
/// <param name="timestamp">input string</param>
/// <returns>DateTime result</returns>
Convert String in short format to DateTime
Convert String in short format to DateTime
public static DateTime ToSimpleShortDate(this string timestamp)
        {
            if (string.IsNullOrWhiteSpace(timestamp))
            {
                throw new NullReferenceException("Input of ToSimpleShortDate cannot be null or a empty string");
            }
            return DateTime.ParseExact(timestamp.Trim(' ', '\t', '\r', '\n', '.', ','), ShortDateFormat, CultureInfo.InvariantCulture);
        }
public static DateTime ToSimpleShortDate ( this string timestamp ) { if ( string . IsNullOrWhiteSpace ( timestamp ) ) { throw new NullReferenceException ( " " ) ; } return DateTime . ParseExact ( timestamp . Trim ( ' ' , ' \t ' , ' \r ' , ' \n ' , ' ' , ' ' ) , ShortDateFormat , CultureInfo . InvariantCulture ) ; }
Convert String in short format to DateTime
Convert String in short format to DateTime
None
string
this
timestamp
None