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
 Time

Author  Topic 

pmccann1
Posting Yak Master

107 Posts

Posted - 2007-02-21 : 09:33:59
whats the best way to record a time in sql not the date just time

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-02-21 : 09:35:41
To what accuracy? Hour? Minute? Second? Millisecond?


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-21 : 09:38:23
datetime datatype. You can make use of datediff(), dateadd() etc to manipulate the data.

see
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=64762
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=65358


KH

Go to Top of Page

pmccann1
Posting Yak Master

107 Posts

Posted - 2007-02-21 : 09:57:24
i just need hour and minute
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2007-02-21 : 10:39:13
quote:
Originally posted by pmccann1

i just need hour and minute



2 Hours, 30 Minutes

DECLARE @x datetime
SELECT @x = DATEADD(hh,2,0)+DATEADD(mi,30,0)
SELECT CONVERT(varchar(10),@x,108)

So what do you really want?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -