Created
September 12, 2011 12:03
-
-
Save jwoschitz/1211105 to your computer and use it in GitHub Desktop.
Get date part in T-SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DATEADD(DAY, 0, DATEDIFF(DAY, 0, GETDATE())) | |
-- Selects the current date as datetime, e.g. 2011-09-10 00:00:00.000 | |
SELECT CONVERT(VARCHAR(8), GETDATE(), 112) | |
-- Selects the current date as varchar, e.g. 20110910 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment