Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SELECT date Field tipo date en format YYYY/MM/DD

Author  Topic 

juandabe
Starting Member

1 Post

Posted - 2014-05-22 : 18:12:25
I have a database in sql server 2008 r2 and written in php application that does not want change, I have some tables with a date field of type date, this is saved 2014-05-20 but then when you make the select from the application i need to kick this date in YYYY/MM/DD format; I do not want to make a conversion of this data to application level; I tried to change the LCID of the driver; set language; but does not work.

thanks for help

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2014-05-22 : 18:28:27
SQL Server does not store dates in a format, per se. They are stored as a number. That number is then formatted for display. If your application is getting a date data type and not displaying it how you want, you'll have to change the application. If the application is getting a string from SQL Server, then you can format the string coming out of the database (although that is hack at best). If you need to format the date value as a string look at the CONVERT function:
http://msdn.microsoft.com/en-us/library/ms187928.aspx
Go to Top of Page
   

- Advertisement -