-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Milestone
Description
Hi,
I'm trying to convert date to string and then parse it back. I'm using short date pattern for that and 'ky' culture. Unfortunately this gives me FormatException when doing DateTime.ParseExact.
From my brief investigation it looks like the pattern, which is 'd-MMM yy' for 'ky' culture, produces additional . (dot) in output in .NET Core 3.0.
Simple code that demonstrates the issue (works fine in .NET Core 2.2):
var cultureInfo = CultureInfo.GetCultureInfo("ky");
Thread.CurrentThread.CurrentCulture = cultureInfo;
var pattern = cultureInfo.DateTimeFormat.ShortDatePattern; // d-MMM yy
Calendar calendar = new GregorianCalendar();
DateTime date1 = calendar.ToDateTime(2000, 1, 4, 0, 0, 0, 0);
// .NET Core 2.2: 4-янв 00
// .NET Core 3.0: 4-янв. 00
var dateAsString = date1.ToString(pattern);
var date2 = DateTime.ParseExact(dateAsString, pattern, cultureInfo);
if (date1 != date2)
throw new InvalidOperationException("Date!");dotnet --version
3.0.100-preview8-013656