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)
 Calculating beginning date/time

Author  Topic 

ravenhawk08
Starting Member

8 Posts

Posted - 2010-02-01 : 10:34:56
I tried to find the answer myself before asking the experts but was unsuccessful.

I'm trying to calculate the start date/timestamp from two columns in a table. One column is the ending timestamp and the other is the duration in seconds. (e.g. endtimestamp = 2010-01-12-09.19.48.000000 and duration = 352)

Is there a way to find the start timestamp with the information I have available?

Thank you.

vijayisonly
Master Smack Fu Yak Hacker

1836 Posts

Posted - 2010-02-01 : 10:47:18
Maybe this?
declare @d datetime
select @d = '20100112 09:19:48.000'

select dateadd(second,-342,@d)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-02-01 : 10:49:01
[code]SELECT DATEADD(Second, 0 - MyDuration, MyEndTimeStamp)[/code]
Go to Top of Page
   

- Advertisement -