/// <summary> /// <para>将字符串日期转换为datetime</para> /// <para>Return BaseDateTimeExtensions.GetCurrentDateTime() on error</para> /// </summary> /// <param name="strValue">string to convert</param> /// <returns>datetime</returns> public static DateTime TryParseDate(this string strValue) { return(strValue.TryParseDate(BaseDateTimeExtensions.GetCurrentDateTime(), BaseDateTimeExtensions.GetCurrentCulture(), BaseDateTimeExtensions.GetDefaultToDateDateTimeStyles())); }
/// <summary> /// 测试字符串值是否是有效的日期值 /// </summary> /// <param name="strValue">string value</param> /// <returns>true/false</returns> public static bool IsValidDate(this string strValue) { return(strValue.IsValidDate( BaseDateTimeExtensions.GetCurrentCulture(), BaseDateTimeExtensions.GetDefaultToDateDateTimeStyles())); }