Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-10-05 : 07:22:26
|
Murugesh writes "Hi,I want to get only the time values from a datetime value.Say for eg: if datetime value is '1/2/2005 1:02:23 AM',I just want to get only '1:02:23 AM' from the above date. Is there anyfunction, i can use or could anyone help me out to fix this?Lots of thanks,T.Murugesh Babu" |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-05 : 07:32:39
|
If it is only for Disply purpose thenselect Convert(varchar,getdate(),8)Otherwise use Format function in your Front End ApplicationMadhivananFailing to plan is Planning to fail |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 07:32:48
|
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55982Duane. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-05 : 07:55:27
|
quote: Originally posted by ditch http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=55982Duane.
ditch, I think that link is not the solution for this question MadhivananFailing to plan is Planning to fail |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 08:04:30
|
why not?it was first converting a float to date time and then extracting the time portion.Duane. |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-10-05 : 08:54:15
|
I think select Convert(varchar,getdate(),8) is enough MadhivananFailing to plan is Planning to fail |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 08:57:32
|
It is.But it can't display the milliseconds Duane. |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2005-10-05 : 11:10:04
|
If you have to show the the milliseconds:select [time]=right(convert(varchar(30),getdate(),121),12)time ---------------11:10:39.793CODO ERGO SUM |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-10-05 : 11:19:16
|
quote: Originally posted by Michael Valentine Jones If you have to show the the milliseconds:select [time]=right(convert(varchar(30),getdate(),121),12)time ---------------11:10:39.793CODO ERGO SUM
NICE Duane. |
|
|
|