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);
Also in C#:
- fibonacci series using recursion
- isGrounded script for copy
- remove from list based on condition c#
- Read csv file into wpf C#
- C# invoke
- c# new list object
- set object to random color unity
- get number of sundays in a month c#
- convert array to list Unity C#
- native-googlesignin configuration is null!?
- download and run exe c# 1 button
- new command - latex
- c# string array
- c# download string url
- unity calculate path
- dynamic group by expression C#
- load scene unity
- how to put double quotes in a string c#
- devexpress objectspace to session
- check if two timespans intersect c#
- ubuntu: how to open the terminal from c#
- c# typeof
- c# expandoobject indexer
- c# checksum