/// <param name="year">年份</param> |
/// <param name="month">月份</param> |
public static ArrayList GetMonth( int year, int month) |
ArrayList arr = new ArrayList(); |
var first = new DateTime(year, month, 1); |
var last = new DateTime(month == 12 ? year + 1 : year, month == 12 ? 1 : month + 1, 1); |
var days = last.Subtract(first).Days; |
var prevDays = ( int )first.DayOfWeek; |
var nextDays = 7 - ( int )last.DayOfWeek; |
var result = new StringBuilder( "" ); |
for ( int i = -prevDays; i < prevDays + days + nextDays; i++) |
arr.Add((i + 1).ToString()); |
转载于:https://www.cnblogs.com/mane/archive/2011/08/10/2133219.html