Last active
November 14, 2017 06:53
-
-
Save UweKeim/6f4e58825bd99727436c6d6b188b72f6 to your computer and use it in GitHub Desktop.
Calculate DayOfCentury for C# DateTime, similar to DayOfYear
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
/// <description> | |
/// Calculates the total number of days passed sind first of January 2000 | |
/// until a given Date. | |
/// </description> | |
public static long DayOfCentury(DateTime dt) | |
{ | |
var span = dt.Date - new DateTime(2000, 1, 1); | |
return (long)span.TotalDays; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment