i want to ignore the time aspect. Is there any parameters you can send to getdate() to specify return of just the date?

This is a discussion on i want to ignore the time aspect. Is there any parameters you can send to getdate() to specify return of just the date? within the sqlserver-server forums in Microsoft SQL Server category; 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...

Go Back   Database Forum > Microsoft SQL Server > sqlserver-server

Database Forums

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-28-2008, 05:48 AM
Default i want to ignore the time aspect. Is there any parameters you can send to getdate() to specify return of just the date?

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



Reply With Quote
  #2  
Old 08-28-2008, 06:06 AM
Default Re: i want to ignore the time aspect. Is there any parameters youcan send to getdate() to specify return of just the date?

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
>
>
>

Reply With Quote
  #3  
Old 08-28-2008, 06:08 AM
Default Re: i want to ignore the time aspect. Is there any parameters you can send to getdate() to specify return of just the date?

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" wrote in message news:OTq0IrOCJHA.1180-at-TK2MSFTNGP04.phx.gbl...
> 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
>
>
>

Reply With Quote
Reply


Thread Tools
Display Modes



All times are GMT -4. The time now is 09:08 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Integrated by bbpixel2008 :: jvbPlugin R1013.368.1

Search Engine Friendly URLs by vBSEO 3.1.0
vB Ad Management by =RedTyger=
In an effort to better serve ads to our visitors, cookies are used on Mydatabasesupport.com. For more information, check out our Privacy Policy.