Skip to content

Instantly share code, notes, and snippets.

@ryanwebjackson
Created October 12, 2017 16:01
Show Gist options
  • Save ryanwebjackson/81fdf3d843bcef416471d7abfdcd613b to your computer and use it in GitHub Desktop.
Save ryanwebjackson/81fdf3d843bcef416471d7abfdcd613b to your computer and use it in GitHub Desktop.
private DateTime? FloorDatetimeToDayPrecision(DateTime? inDatetime)
{
if (inDatetime.HasValue && inDatetime.Value.TimeOfDay > TimeSpan.MinValue)
{
var oldDatetime = inDatetime.Value;
return new DateTime(oldDatetime.Year, oldDatetime.Month, oldDatetime.Day, 0, 0, 0);
}
else
{
return inDatetime;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment