Skip to content

Instantly share code, notes, and snippets.

@clintmjohnson
Created May 14, 2015 21:20
Show Gist options
  • Save clintmjohnson/3d80913903355dd14956 to your computer and use it in GitHub Desktop.
Save clintmjohnson/3d80913903355dd14956 to your computer and use it in GitHub Desktop.
Usage #3 : Format Date from MMDDYYYY to MM/DD/YYYY
DECLARE @MMDDYYYY VARCHAR(10)
SET @MMDDYYYY = '07042013'
SELECT STUFF(STUFF(@MMDDYYYY, 3, 0, '/'), 6, 0, '/') AS [MM/DD/YYYY]
@clintmjohnson
Copy link
Author

DECLARE @mmddyyyy VARCHAR(10)
SET @mmddyyyy = '07042013'

SELECT STUFF(STUFF(@mmddyyyy, 3, 0, '/'), 6, 0, '/') AS [MM/DD/YYYY]

Output

07/04/2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment