Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

get all sundays between two dates c#

IEnumerable<DateTime> GetDaysBetween(DateTime start, DateTime end)
{
    for (DateTime i = start; i < end; i = i.AddDays(1))
    {
        yield return i;
    }
}

var weekends = GetDaysBetween(DateTime.Today, DateTime.Today.AddDays(365))
    .Where(d => d.DayOfWeek == DayOfWeek.Saturday && d.DayOfWeek == DayOfWeek.Sunday);
Comment

PREVIOUS NEXT
Code Example
Csharp :: unity set sprite transparency 
Csharp :: c# how to exit program 
Csharp :: unity set text value 
Csharp :: unity how to change the text on a button 
Csharp :: C# get enum value by DescriptionAttribute 
Csharp :: c# read from text documenmt 
Csharp :: dictionary c# 
Csharp :: unity change color of sprite in script 
Csharp :: How to add a label programatically in c# 
Csharp :: unity read from text file 
Csharp :: change textbox text color c# 
Csharp :: c# get size of file 
Csharp :: c# class to byte array 
Csharp :: unique id c# 
Csharp :: c# shuffle array 
Csharp :: blazor option selected 
Csharp :: timer in c# 
Csharp :: get waht is differnt between two arrays c# 
Csharp :: how to play animation with code in unity 
Csharp :: c# random generator 
Csharp :: c# console background color 
Csharp :: how to map datatable to list in c# 
Csharp :: odd or even in c# 
Csharp :: .net core check if user is logged in 
Csharp :: how to name GameObject in c# 
Csharp :: how to convert string to int in c# 
Csharp :: hashset to list c# 
Csharp :: c# listbox delete selected items 
Csharp :: how to make a global string c# 
Csharp :: convert.tostring with datetime string 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =