c# get month number from name
int month = DateTime.ParseExact(MonthNameStr, "MMMM", CultureInfo.CurrentCulture ).Month
c# get month number from name
int month = DateTime.ParseExact(MonthNameStr, "MMMM", CultureInfo.CurrentCulture ).Month
get number of sundays in a month c#
static int NumberOfParticularDaysInMonth(int year, int month, DayOfWeek dayOfWeek)
{
DateTime startDate = new DateTime(year, month, 1);
int totalDays = startDate.AddMonths(1).Subtract(startDate).Days;
int answer = Enumerable.Range(1, totalDays)
.Select(item => new DateTime(year, month, item))
.Where(date => date.DayOfWeek == dayOfWeek)
.Count();
return answer;
}
int numberOfThursdays = NumberOfParticularDaysInMonth(2010, 9, DayOfWeek.Thursday);
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us