I have the following line of code:
group p by new DateTime((p.DateTime.Value.Ticks / interval.Ticks) * interval.Ticks).TimeOfDay
This works great in LINQ-to-Objects but it will not work in LINQ-to-Entities. I have two quetsions:
Why does it work? I don't understand how dividing the time by an interval and then multiplying it by that same interval magically converts my 12:37 to 12:30. My basic experience with math says that (A/B)*B = A. (Cleared up by @spencer in comments. Much thanks!)
How can I reformat this line to work in LINQ-to-Entities?