private int GetWeekOfMonth (DateTime date)
{
DateTime beginningOfMonth = new DateTime(date.Year, date.Month, 1);
{
DateTime beginningOfMonth = new DateTime(date.Year, date.Month, 1);
while (date.Date.AddDays(1).DayOfWeek != System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.FirstDayOfWeek)
date = date.AddDays(1);
date = date.AddDays(1);
return (int)Math.Truncate((double)date.Subtract(beginningOfMonth).TotalDays / 7f) + 1;
}
}
Комментариев нет:
Отправить комментарий