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)
 convert datetime to shortdate

Author  Topic 

desikankannan
Posting Yak Master

152 Posts

Posted - 2013-11-18 : 07:54:54
Hi,

i want to convert dattime to shortdate

2013-10-15 00:00:00.000 i want to display 10/15/2013 , iam doing sorting in asp.net its should not varchar

Desikankannan

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-11-18 : 08:26:45
If you are doing it in ASP.Net, use ToString with format specifier = "d". See here: http://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx

You could do a similar thing in SQL, but I would recommend doing the conversion in ASP.Net. If you do want to do the conversion in SQL, use convert(CHAR(10),YourDate,101)
Go to Top of Page
   

- Advertisement -