Horje
get number of sundays in a month c# Code Example
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);




Csharp

Related
change name of gameobject Code Example change name of gameobject Code Example
plays ervices unity sigin Code Example plays ervices unity sigin Code Example
spawning object around  in a circle of an gameobject unity' Code Example spawning object around in a circle of an gameobject unity' Code Example
xamarin forms set the grid row property of an element programmatically Code Example xamarin forms set the grid row property of an element programmatically Code Example
Bitwise Left Shift C# Code Example Bitwise Left Shift C# Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
11