August 1, 2017 at 5:10 pm
I haven't been able to successfully update this code.
Oracle
REPLACE(TO_CHAR(PRAC.DATE_OF_BIRTH,'MM-DD-YYYY'),'-','/') AS DOB,
SQL Server
REPLACE(CAST(PRAC.DATE_OF_BIRTH AS DATE ['MM-DD-YYYY']),'-','/') AS DOB,
Thanks in advance for any assistance.
August 1, 2017 at 5:29 pm
kawi6rr - Tuesday, August 1, 2017 5:10 PMI haven't been able to successfully update this code.
Oracle
REPLACE(TO_CHAR(PRAC.DATE_OF_BIRTH,'MM-DD-YYYY'),'-','/') AS DOB,SQL Server
REPLACE(CAST(PRAC.DATE_OF_BIRTH AS DATE ['MM-DD-YYYY']),'-','/') AS DOB,Thanks in advance for any assistance.
It depends on what the data type is for DATE_OF_BIRTH.
Generally you can use something like: SELECT REPLACE(CONVERT (varchar(10), GETDATE(), 110), '-', '/') AS DOB
which would return today's date as 08/01/2017
Sue
August 2, 2017 at 2:57 am
Yes, or return dates as dates, and if you need to make it all look pretty, do that in the presentation layer.
John
August 2, 2017 at 6:19 am
Or you could remove the REPLACE altogether with a different format code.SELECT CONVERT (char(10), GETDATE(), 101) AS DOB
But I agree with leaving the formatting in the presentation layer and keep the dates as dates for as long as possible.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy