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
 Cast Required for datetime

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-09-05 : 09:42:38
Imran writes "Hi All !

I have required a simple cast that is i want to get just time from datetime field.
Example :
I have data '1/1/1900 10:30 PM' now i want to get just 10:30 pm from it if any one can send me a query please do it.
My email is Imran_mcs2002@yahoo.com"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-05 : 09:52:56
Do this in your presentation layer(Fron End application or Reports)
Otherwise you need to use Convert function


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2005-09-05 : 14:50:40
select stuff(right(convert(varchar(19),dte,100),7), 6,0,' ')


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -