select datediff(ss, sd.crdate, sd.dumptrdate)
from sysdatabases sd
I am able to retrieve the seconds between the 2 timestamps.
36495950
36407822
11106342
Command has been aborted.
Unfortunately, the problem is that the crdate will often default to 1/1/1900.
This causes a 535 error and the Command has aborted message above.
It is important to remember that datediff produces results of datatype int, and causes errors if the result is greater than 2,147,483,647.
1)For seconds, this is 68 years, 19 days, 3:14:07 hours.
2)For milliseconds, this is approximately 24 days, 20:31.846 hours.
cheers
knel
Main Topics
Browse All Topics





by: bretPosted on 2007-03-27 at 08:18:12ID: 18800557
The TSQL datediff function is probably the place to start, you can get the difference between any two dates in various units, including seconds. You will then need to make adjustments for the difference between the time zone the date is from and UTC. And adjustments for whether the date was affected by daylight savings time or not. Note that ASE doesn't store any information about time zone or daylight savings time, and the environment ASE ran under may have changed over time (i.e. from one time zone to another if corporate headquarters moved, etc.), so you may need to gather some historical metaknowledge about the server's history to get a correct result. I don't think the datediff function makes any adjustments for leap seconds, either.
(I recommend running ASE servers in a UTC environment, making clients responsible for any conversions to their local timezone).