- Get the day 00:00:00
SELECT CONVERT(DATETIME,CONVERT(VARCHAR(10),GETDATE(),120))
SELECT convert (varchar (10), getdate (), 120) - the current time is converted into type character type, and remove only the date information.
SELECT convert (varchar (10), getdate (), 120) + '00:00:00' - is the current time plus hours every second time character of the composition.
SELECT cast (convert (varchar (10), getdate (), 120) + '00:00:00' as datetime) - is transformed into the character type data, and outputs date.
- Get the day 23:59:59
SELECT DATEADD(SS,-1,DATEADD(DD,1,CONVERT(DATETIME,CONVERT(VARCHAR(10),GETDATE(),120))))
SELECT CONVERT(DATETIME,CONVERT(VARCHAR,GETDATE(),112),112)+1-1.0/3600/24