DEV Community

Himanshu Jha
Himanshu Jha

Posted on

SQL Tricks

  • SQL Tricks

How to get the current date with time as 00:00:00.

eg today is 13/Apr/2023 then output should be 2023-04-13 00:00:00.

Answers.

  1. Select Cast(Cast(Getdate() as date)as datetime)

  2. Select Dateadd(day,0,Datediff(dd,0,Getdate()))

There are many other ways as well.

Latest comments (0)