Skip to content

Instantly share code, notes, and snippets.

@margusmartsepp
Created April 27, 2016 11:57
Show Gist options
  • Save margusmartsepp/0601b762a418a757501673be541321b8 to your computer and use it in GitHub Desktop.
Save margusmartsepp/0601b762a418a757501673be541321b8 to your computer and use it in GitHub Desktop.
Is date after epoch
/// <summary>
/// https://en.wikipedia.org/wiki/Epoch_(reference_date)
/// </summary>
public static class DateTimeValidator
{
public static DateTime Epoch => Epoch1900;
public readonly static DateTime Epoch1900 = new DateTime(1900, 1, 1);
public readonly static DateTime EpochSqlDateTime = (DateTime)SqlDateTime.MinValue;
public static bool IsValid(DateTime dateTime)
{
return dateTime >= Epoch;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment