SELECT GETDATE()
returns 2007-12-17 21:17:33.933
Let us quickly see how to return only the date portion in different formats
YYYY-MM-DD
SELECT CONVERT(VARCHAR(10), GETDATE(), 120)
returns 2007-12-17
MM-DD-YYYY
SELECT CONVERT(VARCHAR(10), GETDATE(), 110)
returns 12-17-2007
DD-MM-YYYY
SELECT CONVERT(VARCHAR(10), GETDATE(), 105)
returns 17-12-2007
By default, you get both the date and time value whenever you retrieve a datetime value from the database. So something like :
转载于:https://www.cnblogs.com/josephshi/archive/2008/04/02/1134417.html