I find on many websites and do many exercieses following are the output summary for those.
-- return datetime portion without time (best is from top to bottom)
1. SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
2. SELECT CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)
3. SELECT CONVERT(DATETIME, CONVERT(INT, GETDATE()))
4. CAST(CONVERT(varchar, GetDate(), 101)
-- return datetime portion without time (best is from top to bottom)
1. SELECT DATEADD(dd, 0, DATEDIFF(dd, 0, GETDATE()))
2. SELECT CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)
3. SELECT CONVERT(DATETIME, CONVERT(INT, GETDATE()))
4. CAST(CONVERT(varchar, GetDate(), 101)
1 comment:
Nice comment kindly also tell us returning date portion and time portion separately.
Post a Comment