Maybe I'm going crazy or maybe I'm paranoid even though I may think no one is following me but I'm having a heck of a time with the new format function in SQL Denali. Try this for me:
DECLARE @d DATETIME = GETDATE();
SELECT FORMAT( @d, 'dd', 'en-US' ) AS Result;
SELECT FORMAT( @d, 'd/m/y', 'en-US' ) AS Result;
SELECT FORMAT( @d, 'dd/mm/yyyy', 'en-US' ) AS Result;
My results are the following:
I always assume it is not a bug but instead I'm doing something wrong. I would appreciate anyone who has comments or who can correct the problem for me. Just so you know I'm running this on Denali CTP3.
Aaron Bertrand has a most excellent blog on the format function but he doesn't use the getdate function. I'm open to suggestions, but please stop looking in my windows at night.