Discussion Locked

Grouping dates into days

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am trying to group a date Range result set of say one month into days between 22:00:00 and 21:59:59. I's this possible with SQL or do I have to do it in my .NET application?

2 replies

by tony hopkinson

but the easy way is something like
Select DatePart('day',DateAdd(2, hour,mydatefield)) From My Table
Where MyDateField >= ... 22:00 and MyDateField <= ....21:59.
whatever the exact syntax add two hours to get to the date boundary and then select the day of the month from that.

This discussion is closed to new replies.