How do I get the date part from datetime variable ? e.g declare @start_time datetime select @start_time = "10/31/2003" This puts date and current System time into the variable. I use this for some comparison on datetime field on database. But when I do the comparison, I want to do the comparison without time part on database field and my variable. How do I do that ? Thanks
![]() |
0 |
![]() |
Check out the datepart function. In article <3fd10c0f$1@forums-1-dub>, <phari> says... > How do I get the date part from datetime variable ? > > e.g > declare @start_time datetime > > select @start_time = "10/31/2003" > > This puts date and current System time into the variable. > > I use this for some comparison on datetime field on database. But when I do > the comparison, I want to do the comparison without time part on database > field and my variable. How do I do that ? > > Thanks > > >
![]() |
0 |
![]() |
or CONVERT function (pay attention to third parameter) example: select convert(varchar(10),getdate(),112) result: 20031208 -<-- YYYYMMDD select convert(varchar(10),getdate(),108) result: 17:40:30 -<--- HH:MM:SS Regards, Andrew "Mark Maslow" <mark.maslow@sierraclub.org> wrote in message news:MPG.1a3aab35f3ce419896ef@forums.sybase.com... > Check out the datepart function. > > In article <3fd10c0f$1@forums-1-dub>, <phari> says... > > How do I get the date part from datetime variable ? > > > > e.g > > declare @start_time datetime > > > > select @start_time = "10/31/2003" > > > > This puts date and current System time into the variable. > > > > I use this for some comparison on datetime field on database. But when I do > > the comparison, I want to do the comparison without time part on database > > field and my variable. How do I do that ? > > > > Thanks > > > > > >
![]() |
0 |
![]() |