nochmal Datumsformate angepasst für ein anderes Problem
This commit is contained in:
parent
217dbcfcde
commit
d31cc825cb
@ -448,7 +448,7 @@ namespace ENI2.Excel
|
|||||||
|
|
||||||
if (date == null)
|
if (date == null)
|
||||||
{
|
{
|
||||||
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy" };
|
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
||||||
if (DateTime.TryParseExact(val, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
|
if (DateTime.TryParseExact(val, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
date = tmpDate;
|
date = tmpDate;
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ namespace ENI2.Excel
|
|||||||
if (date == null)
|
if (date == null)
|
||||||
{
|
{
|
||||||
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
||||||
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy" };
|
string[] formats = { "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d", "dd-MM-yyyy" };
|
||||||
if (DateTime.TryParseExact(val, formats, en, DateTimeStyles.None, out DateTime tmpDate))
|
if (DateTime.TryParseExact(val, formats, en, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
return tmpDate;
|
return tmpDate;
|
||||||
}
|
}
|
||||||
@ -705,7 +705,7 @@ namespace ENI2.Excel
|
|||||||
string dateString = ReadCellAsText(sheetName, range);
|
string dateString = ReadCellAsText(sheetName, range);
|
||||||
if (dateString != null)
|
if (dateString != null)
|
||||||
{
|
{
|
||||||
string[] formats = { "yyyy/MM/dd HH:mm", "yyyy/MM/dd", "dd.MM.yyyy", "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy" };
|
string[] formats = { "yyyy/MM/dd HH:mm", "yyyy/MM/dd", "dd.MM.yyyy", "dd-MM-yyyy", "d/M/yyyy", "dd/M/yyyy", "d/MM/yyyy", "dd/MM/yyyy", "d/MMM/yyyy", "dd/MMM/yyyy", "yyyy-MM-dd", "yyyy-mm-d" };
|
||||||
if (DateTime.TryParseExact(dateString, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
|
if (DateTime.TryParseExact(dateString, formats, NumberFormatInfo.InvariantInfo, DateTimeStyles.None, out DateTime tmpDate))
|
||||||
return tmpDate;
|
return tmpDate;
|
||||||
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
CultureInfo en = CultureInfo.CreateSpecificCulture("en-US");
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user