Reputation: 389
I'm trying to convert a DateTime field (Date of Birth), within the an SELECT FROM that needs to work for SQL CE and SQL Access databases.
I've found a thread that shows me that it can be done, but not the formate I want it to be. Does anyone know how I can change this to show yyyy-mm-dd format not mm/dd/yyyy
SELECT CONVERT(nvarchar(10), C.DOB,101) FROM table
Upvotes: 0
Views: 1007
Reputation: 389
I've been able to find how I can do it. Its using the convert function, but the code passed into it is different
So to get the correct format, I need the below code
CONVERT(nvarchar(10), A.TestDate,21)
Upvotes: 0
Reputation: 3681
You can use the following query
SELECT CONVERT(NVARCHAR(10), C.DOB, 120) AS FormatedDate FROM Table
Upvotes: 1