, , 01/29:
Regex.Replace(c.DateTimeFormat.ShortDatePattern, @"(yy(yy)?[/\.\- ]|[/\.\- ]yy(yy)?)", "")
Here is the output format for all cultures, so you can see if it will work for you:
CultureInfo.GetCultures(CultureTypes.AllCultures)
.Select(c => new {
c.Name,
c.DateTimeFormat.MonthDayPattern,
c.DateTimeFormat.ShortDatePattern,
DayMonth1 = Regex.Replace(c.DateTimeFormat.ShortDatePattern, @"[/\.\- ]?yy[/\.\- ]?", ""),
DayMonth2 = Regex.Replace(c.DateTimeFormat.ShortDatePattern, @"(yyyy[/\.\- ]|[/\.\- ]yyyy|yy[/\.\- ]|[/\.\- ]yy)", ""),
DayMonth3 = Regex.Replace(c.DateTimeFormat.ShortDatePattern, @"(yy(yy)?[/\.\- ]|[/\.\- ]yy(yy)?)", "")
})
.OrderBy(x => x.Name)
.Dump();
Substitution DateMonth1will remove the extra fill character for a pair of crops (in particular, “bg”).
source
share