How to convert this query to linq?
Example:
`select dateadd(hour, datediff(hour, 0, '2020-05-17 19:20:00' ), 0)`
Result: `'2020-05-17 19:00:00'`
Update question to more detail..
Example Input data:
**DateTimeColumn**
2020-05-17 11:29:12.1234
2020-05-17 19:20:00.2132
2020-05-17 19:30:00.2132
2020-05-17 22:34:22.2134
2020-05-18 11:01:01.1111
Query:
select dateadd(hour, datediff(hour, 0, DateTimeColumn ), 0) as NewTime, Count(*) as Count from Table group by dateadd(hour, datediff(hour, 0, DateTimeColumn ), 0)
Result:
**NewTime** **Count**
2020-05-17 11:00:00 1
2020-05-17 19:00:00 2
2020-05-17 22:00:00 1
2020-05-18 11:00:00 1
Purpose: Need a linq query for group by hour, can't use group by datetime.hour
due to it will merge hourly data with different date (example the 11 A.M for 17/5 and 18/5 are two different data, can't group together)