|
|
submitted by
mikeinmadison
1 year, 3 months ago
mikeinmadison.wordpress.com — I recently needed to group by minutes (or seconds, or hours, or days) in a LINQ to SQL expression, and I found that there isn’t a round function built into the C# DateTime object. The following will round to the nearest second, minute, hour, or day. I stopped there because different months have different numbers of days (and I don’t need to group by months…) but it is easy enough to add months and years to the code.
|
|
tags:
ASP.NET | tag it
Everyones tags: | Your tags: | |
|
|
|