Last active
August 29, 2015 14:19
-
-
Save ycaroafonso/cae52dce321601edc92e to your computer and use it in GitHub Desktop.
Convert DDMMYY to DateTime
This file contains 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
ALTER FUNCTION dbo.Convert_DDMMYY_To_DateTime (@DiaMesAno INT) | |
RETURNS DATETIME | |
AS | |
BEGIN | |
-- Ycaro Afonso (2015-04-19) | |
DECLARE @Data VARCHAR(20) = STUFF(STUFF(@DiaMesAno, 3, 0, '/'), 6, 0, '/') | |
RETURN CONVERT(DATETIME, @Data, 3) | |
END | |
GO | |
SELECT dbo.Convert_DDMMYY_To_DateTime(190415) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment