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.
| Author |
Topic |
|
agnesvictoria
Starting Member
3 Posts |
Posted - 2007-09-05 : 01:32:28
|
| Hi everyone,Please tell me is there any function to convert the given time format hh:mm:ss into seconds.I have got one of the solutions as (15*3600+23*60+4)/86400Thanks in advance. |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-09-05 : 01:35:15
|
the given time is in datatime data type or string ? KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
Vinnie881
Master Smack Fu Yak Hacker
1231 Posts |
Posted - 2007-09-05 : 01:37:29
|
| select datediff(s,'09/04/2007',getdate()) |
 |
|
|
agnesvictoria
Starting Member
3 Posts |
Posted - 2007-09-05 : 01:38:03
|
quote: Originally posted by khtan the given time is in datatime data type or string ? KH[spoiler]Time is always against us[/spoiler]
It is a string value. |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-09-05 : 01:38:21
|
[code]DECLARE @timestr varchar(10), @time datetimeSELECT @timestr = '12:34:56', @time = '12:34:56'SELECT DATEDIFF(second, 0, @timestr), DATEDIFF(second, 0, @time)[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
agnesvictoria
Starting Member
3 Posts |
Posted - 2007-09-05 : 02:09:38
|
quote: Originally posted by khtan
DECLARE @timestr varchar(10), @time datetimeSELECT @timestr = '12:34:56', @time = '12:34:56'SELECT DATEDIFF(second, 0, @timestr), DATEDIFF(second, 0, @time) KH[spoiler]Time is always against us[/spoiler]
Thanks alot. |
 |
|
|
|
|
|
|
|