using System.Globalization;
using static System.Console;
public static void Main()
int[] years = { 2012, 2014 };
DateTimeFormatInfo dtfi = DateTimeFormatInfo.CurrentInfo;
WriteLine("Days in the Month for the {0} culture " +
"using the {1} calendar\n",
CultureInfo.CurrentCulture.Name,
dtfi.Calendar.GetType().Name.Replace("Calendar", ""));
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]))
WriteLine("{0,-10}{1,-15}{2,4}", year,
DateTime.DaysInMonth(year, ctr + 1));