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
 General SQL Server Forums
 New to SQL Server Programming
 DATETIME

Author  Topic 

gator8869
Starting Member

37 Posts

Posted - 2007-08-27 : 17:11:40
I have two columns in a view that reutrn the following
AdmitDate AdmitTime
2007-08-21 00:00:00.000 1900-01-01 15:42:00.000
2007-08-21 00:00:00.000 1900-01-01 01:19:00.000
2007-08-20 00:00:00.000 1900-01-01 13:52:00.000
2007-08-19 00:00:00.000 1900-01-01 13:49:00.000

I need to return just the date xxxx-xx-xx for AdmitDate and xx:xx for admit time

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-08-27 : 17:13:02
Where is this data being presented to? This kind of formatting should be done at the presentation layer.

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-27 : 17:14:37
Why, Oh Heavenly Father, why have you let Gator split DATE and TIME?

SELECT CONVERT(CHAR(10), AdmitDate, 112), CONVERT(CHAR(5), AdmitTime, 108)
FROM Table1


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

gator8869
Starting Member

37 Posts

Posted - 2007-08-27 : 22:36:52
Thank you
Go to Top of Page
   

- Advertisement -