nakul
nakul

Reputation: 1463

How to remove timestamp from date without converting it in varchar in sql server?

I am comparing a "date" with current date(GETDATE()) using DATEDIFF().

The problem i am facing is that the "date" is in dd/MM/yyyy format and the date i am getting using GETDATE() includes the timestamp also.

Please guide me how to remove the timestamp from GETDATE(),and also want to compare these two dates.

Thanks in advance.

Upvotes: 0

Views: 17680

Answers (1)

ta.speot.is
ta.speot.is

Reputation: 27214

Please guide me how to remove the timestamp from GETDATE(),

The documentation for GETDATE has this contribution at the bottom of the page:

CAST(DATEDIFF(Day, 0, GETDATE()) AS DATETIME)

Upvotes: 4

Related Questions