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.
Author |
Topic |
eugz
Posting Yak Master
210 Posts |
Posted - 2013-09-13 : 11:48:09
|
Hi All.I'm using SQL Server 2008. I table datetime fild display value like 2008-09-22 15:24:00.000. How to modify functionDATEADD(DD, 0, DATEDIFF(DD, 0, DateField)) as Dateto get result like mm/dd/yyyy?Thanks |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-09-13 : 12:02:09
|
You can use the CONVERT function to convert and format the date as a string, but that is really something you should let your presentation layer handle.SELECT CONVERT(VARCHAR(10), GETDATE(), 101) http://technet.microsoft.com/en-us/library/ms187928.aspxEDIT: Forgot code sample |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2013-09-13 : 15:23:20
|
You can just cast it to a date. CAST(getdate() as date) |
|
|
jeffw8713
Aged Yak Warrior
819 Posts |
Posted - 2013-09-13 : 15:23:43
|
You can just cast it to a date. CAST(getdate() as date) |
|
|
|
|
|