using System.Globalization;
public static void Main()
int[] years = { 2016, 2019 };
DateTimeFormatInfo dtfi = DateTimeFormatInfo.CurrentInfo;
Console.WriteLine("Days in the Month for the {0} culture using the {1} calendar\n", CultureInfo.CurrentCulture.Name, dtfi.Calendar.GetType().Name.Replace("Calendar", ""));
Console.WriteLine("{0,-10}{1,-15}{2, -4}\n", "Year", "Month", "Days");
foreach (var year in years)
for (int ctr = 0; ctr <= dtfi.MonthNames.Length - 1; ctr++)
if (String.IsNullOrEmpty(dtfi.MonthNames[ctr]))
Console.WriteLine("{0,-10}{1,-15}{2, -4}", year, dtfi.MonthNames[ctr], year.DaysInMonth(ctr + 1));