-
Dates without times
Anyone know of an easy way to work with datetime columns ignoring the time part.
I want to "group by" the date so it is vital that the time part goes.
But I still want to work with the resulting date as a date (i.e. use date functions) so I would prefer to keep the datetime data type.
-
Dates without times (reply)
On 7/27/98 10:45:11 AM, Paul Ross wrote:
> Anyone know of an easy way to work with datetime columns ignoring the time
> part.
I want to "group by" the date so it is vital that the time part
> goes.
But I still want to work with the resulting date as a date (i.e.
> use date functions) so I would prefer to keep the datetime data type.
Use "group by DATEDIFF(day, date_field, "1/1/1900")" OR "group by DATEPART(year, date_field),DATEPART(month, date_field),DATEPART(day, date_field)"
good luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|