From: Kent Prokopy on
WOW!!!

I ask for simple and that is what I get.
This is very nice.

THANK YOU!!!

"jgurgul" wrote:

> Hi,
>
> DECLARE @DT DATETIME
> SET @DT ='03/29/2010 23:31:15'
> SELECT DATEADD(mi,-(DATEPART(mi,@DT) % 30),(DATEADD(mi, DATEDIFF(mi, 0,
> @DT), 0)))
>
> Jon
>
> "Kent Prokopy" wrote:
>
> > Is there an easy way to convert a field that stores datetime to the startting
> > half hour interval?
> >
> > Example:
> > '03/29/2010 00:00:01' should be '03/29/2010 00:00:00'
> > '03/29/2010 04:45:52' should be '03/29/2010 04:30:00'
> > '03/29/2010 23:07:15' should be '03/29/2010 23:00:00'