Home » Questions » Computers [ Ask a new question ]

How to remove the time portion of a datetime value (SQL Server)?

How to remove the time portion of a datetime value (SQL Server)?

"Here's what I use:

SELECT CAST(FLOOR(CAST(getdate() as FLOAT)) as DATETIME)

I'm thinking there may be a better and more elegant way.

Requirements:

It has to be as fast as possible (the less casting, the better).
The final result has to be a datetime type, not a string."

Asked by: Guest | Views: 108
Total answers/comments: 0