Last active
October 1, 2021 09:35
-
-
Save kyawzaymoore/1a432da2fb715675061ec0b4dc15302f to your computer and use it in GitHub Desktop.
Linq Between two dates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
public class Program | |
{ | |
public static void Main() | |
{ | |
DateTime assignDateStart = DateTime.Now.AddDays(5).Date; | |
DateTime assignDateEnd = DateTime.Now.AddDays(6).Date; | |
DateTime startDate = DateTime.Now.AddDays(3).Date; | |
DateTime endDate = DateTime.Now.AddDays(8).Date; | |
if((startDate <= assignDateStart && assignDateStart <= endDate) || (startDate <= assignDateEnd && assignDateEnd <= endDate)) | |
{ | |
Console.WriteLine("True ---> " + startDate.ToString("dd MMM") + " <= " + assignDateStart.ToString("dd MMM") + " - " + assignDateEnd.ToString("dd MMM") + " <= " + endDate.ToString("dd MMM")); | |
} | |
else | |
{ | |
Console.WriteLine("False ---> " + startDate.ToString("dd MMM") + " <= " + assignDateStart.ToString("dd MMM") + " - " + assignDateEnd.ToString("dd MMM") + " <= " + endDate.ToString("dd MMM")); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment