public static bool TryParseLocalDate( [NotNull] string dateString, out DateTime date ) {
if( dateString == null ) throw new ArgumentNullException( "dateString" );
if( dateString.Length <= 1 ) {
date = DateTime.MinValue;
return false;
} else {
if( !DateTime.TryParse( dateString, cultureInfo, DateTimeStyles.None, out date ) ) {
CultureInfo[] cultureList = CultureInfo.GetCultures( CultureTypes.AllCultures );
foreach( CultureInfo otherCultureInfo in cultureList ) {
cultureInfo = otherCultureInfo;
try {
if( DateTime.TryParse( dateString, cultureInfo, DateTimeStyles.None, out date ) ) {
date = date.ToUniversalTime();
return true;
}
} catch( NotSupportedException ) { }
}
throw new Exception( "Could not find a culture that would be able to parse date/time formats." );
} else {
return true;
}
}
}