Skip to content

Instantly share code, notes, and snippets.

@Larry57
Created January 18, 2013 10:02
Show Gist options
  • Select an option

  • Save Larry57/4563563 to your computer and use it in GitHub Desktop.

Select an option

Save Larry57/4563563 to your computer and use it in GitHub Desktop.
Truncate milliseconds in a DateTime
DateTime truncateMs(DateTime date)
{
return new DateTime((date.Ticks / TimeSpan.TicksPerSecond) * TimeSpan.TicksPerSecond);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment