Using GETDATE() to return a date only without time

I need to use (I think) the GETDATE() function to return the current date, but I need to make sure that it is only the date and no time, or at least time to be 0.
Is this the right way to go about it

CONVERT(DateTime, CONVERT(Char, GETDATE(), 103), 103))

or is there a better way

Thanks in advance
LVL 15
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Thandava VallepalliCommented:
yours is best one....

Thandava VallepalliCommented:
this is enough right?,  why are u again converting i.e 2 times converting in ur query

select convert(varchar, getdate(), 103)

mikelittlewoodAuthor Commented:
Im converting it twice so I get it back in date form of the format 'dd/mm/yyyy 00:00:00' and not something like 'dd/mm/yyyy 12:30:05'
It seems to set the time to 0 which is what I want
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

you can get slight improvement if instead of converting to a char, you convert to integer this will truncate the time portion. If you want you can cast back to datetime, but this will be done explicitly for you anyway if you assign to a datetime variable, or complare to a datetime field etc.

select cast(cast(getdate() as integer) as datetime)
This is better

CONVERT(datetime, FLOOR(CONVERT(float(24), GETDATE())) )

casting direct to int rounds to the nearest integer which is not what you want


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mikelittlewoodAuthor Commented:
Thanks for the advice all
absolutely right, sorry for the bum steer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.