December 28, 2004 at 7:59 am
Riddle me this batman...
(and no I'm not the orginator of this discussion)
What if you want the number of Seconds since some time period?
Let say you want to know the number of seconds since 7/4/2004, what's the query?
December 28, 2004 at 8:11 am
That's unfair!
select
getdate()
, datediff(ss,cast('7/4/2004' as datetime), getdate())%60
------------------------------------------------------ -----------
2004-12-28 16:00:59.590 59
(1 row(s) affected)
Now add 1 and get 0 => No time difference between both date. q.e.d.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
December 28, 2004 at 8:25 am
Why did you add % 60? Second answer seems to work as expected.
Happy New Year!
Steve
December 29, 2004 at 12:56 am
Blame it on the language barrier. I thought, your question wasn't meant seriously. I guess I got confused by this "Riddle me this batman..." phrase.
Anyway, happy new year, too.
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
Viewing 5 posts - 16 through 19 (of 19 total)
You must be logged in to reply to this topic. Login to reply