Reputation: 113
What's the best way to convert the following statement to show the MMDDYYYY
format such as 02022013
without slashes or hyphens...
CONVERT (CHAR(10), A.POKFRM, 112)
Upvotes: 7
Views: 37893
Reputation: 2526
you can you Format function.
SELECT FORMAT(GETDATE(), 'MMddyyyy') AS FormatDate
result: 10142024
Upvotes: 0
Reputation: 1904
You could take a formatting that gives you elements in order but with /
or -
and then replace the /
or -
to get your desired result.
select REPLACE(CONVERT (CHAR(10), getdate(), 101),'/','')
Result:
02022015
Upvotes: 18