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)
 odd decimal date/time

Author  Topic 

edpel
Starting Member

22 Posts

Posted - 2004-04-07 : 15:00:58
I am working with an app (Star Team) which stores its datetimes as decimals. The problem is, the time displayed in the app is 4/7/2004 1:34:43 PM, yet the time in the db is 38084.7324421296. The strange part is each decimal time in the db seems to be off by different icrements. Anyone come across anything like this?


Thanks,
Eddie

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-04-07 : 16:13:58
Here is how to convert from datetime to decimal:

declare @date datetime
set @date = 'June 7 2004 09:37:00.000'
SELECT CONVERT(decimal(13,4),@date)

So just do the reverse:

SELECT CONVERT(DATETIME, 38143.4007)



I've got one app that stores the datetime values as the number of milliseconds since Jan 1, 1970.

Tara
Go to Top of Page
   

- Advertisement -