Created
July 7, 2015 03:14
-
-
Save christopherbauer/47720bd3888d134cba89 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Verify if a datetime is in a range | |
| public static bool BetweenInclusive(this DateTime dateToCompare, | |
| DateTime Left, DateTime Right) | |
| { | |
| bool result = (dateToCompare.CompareTo(Left) >= 0) && | |
| (dateToCompare.CompareTo(Right) <= 0); | |
| return result; | |
| } | |
| // Verify if a datetime is in a range | |
| public static bool BetweenExclusive(this DateTime dateToCompare, | |
| DateTime Left, DateTime Right) | |
| { | |
| bool result = (dateToCompare.CompareTo(Left) > 0) && | |
| (dateToCompare.CompareTo(Right) < 0); | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment