CSharp examples for System:DateTime Month
Month Of Total Day
using System.Globalization; using System.Text.RegularExpressions; using System.Web; using System.Linq; using System.Collections.Generic; using System;//from w ww . j av a 2 s . c o m public class Main{ public static int MonthOfTotalDay(int year, int month) { if (year <= 0001 || year >= 9999) return -1; if (month < 1 || month > 12) return -1; return DateTime.DaysInMonth(year, month); } public static int MonthOfTotalDay() { DateTime _now = DateTime.Now; return DateTime.DaysInMonth(_now.Year, _now.Month); } }