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 2000 Forums
 SQL Server Development (2000)
 extracting hh:mm:ss from datetime field

Author  Topic 

jim_cool
Starting Member

43 Posts

Posted - 2006-01-24 : 07:10:15
hi all

i want to extract hours, min, seconds from datetime field from table.

how can i do this in sql server 2000

plz help me.

also i want to compare two datetime fields using same format , how to do this?

plz help me. Waiting for reply

shallu1_gupta
Constraint Violating Yak Guru

394 Posts

Posted - 2006-01-24 : 07:14:05
try this
select convert(varchar,getdate(),108)
Go to Top of Page

jim_cool
Starting Member

43 Posts

Posted - 2006-01-24 : 07:24:30
thanks for ur reply

but , i still have doubt.

the name of column in my table is Appointment . where shud i specify this column name?

also how can i compare such datetime values using operators such as < & >.

plz reply
Go to Top of Page

ditch
Master Smack Fu Yak Hacker

1466 Posts

Posted - 2006-01-24 : 07:43:17
To extract hh:mm:ss from column Appointment use select convert(varchar,Appointment,108)

For comparison the column itself should be good enough as long as you want the date and the time to be part of the comparison
ie where Appointment > arbDate


Duane.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-24 : 07:50:17
Also refer
http://vyaskn.tripod.com/searching_date_time_values.htm

Madhivanan

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

- Advertisement -