| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
|
| Dear All, I want to compare a date with a getDate() the problem is that the getDate() returns the time too... hence 1/1/2004 >= 1/1/2004 13:21 is false... hence 1/1/2004 >= 1/1/2004 is true... i want to ignore the time aspect. Is there any parameters you can send to getdate() to specify return of just the date? Thanks harshad prajapati |
|
#2
|
| Hi , you cant 'ignore' time as it is an integral part of a datetime variable. The best way to set the time to midnight today would be SELECT DATEDIFF(DAY,0,GetDate()) Dave harshad wrote: > Dear All, > > I want to compare a date with a getDate() > > the problem is that the getDate() returns the time too... > hence 1/1/2004 >= 1/1/2004 13:21 is false... > hence 1/1/2004 >= 1/1/2004 is true... > > i want to ignore the time aspect. Is there any parameters you can send to > getdate() to specify return of just the date? > > Thanks > > harshad prajapati > > > |
|
#3
|
| http://www.karaszi.com/SQLServer/inf....asp#Searching -- Tibor Karaszi, SQL Server MVP http://www.karaszi.com/sqlserver/default.asp http://sqlblog.com/blogs/tibor_karaszi "harshad" > Dear All, > > I want to compare a date with a getDate() > > the problem is that the getDate() returns the time too... > hence 1/1/2004 >= 1/1/2004 13:21 is false... > hence 1/1/2004 >= 1/1/2004 is true... > > i want to ignore the time aspect. Is there any parameters you can send to > getdate() to specify return of just the date? > > Thanks > > harshad prajapati > > > |
![]() |
| Thread Tools | |
| Display Modes | |