Hi all,
I've come accross this code and need to alter it to display a normal General Date format.
CASE WHEN p.BIRTHDTTM IS NULL THEN ''
ELSE RIGHT('0' + LTRIM(CONVERT(VARCHAR(20), BIRTHDTTM, 113)) , 20)
END AS BIRTHDTTM
The original data (which is a DOB field) looks like this
1936-08-14 00:00:00.000
And the code above is turning it into this which is good but means I cannot then format in SSRS
14 Aug 1936 00:00:00
so ideally I'd like the code above to be altered so that it gives me
14/08/1936
Good day ,
Try to use 103 instead 113 style :-)
SELECT CONVERT(VARCHAR(10), GETDATE(), 103)
I highly recommend to keep reading!
>> to display a normal General Date format
Normal for one is not Normal for the other :-)
Date and time Normal formats depends on the culture.
>> The original data
The original date in the database actually has nothing to do with the displaying format. I highly recommend to read this blog:
Date displaying format, vs Date storing format
>> so ideally I'd like the code above to be altered so that it gives me 14/08/1936
This format fit to style 103. YOu can see more format options in this link:
https://msdn.microsoft.com/en-us/library/ms187928.aspx?f=255&MSPPError=-2147217396