April 13, 2006 at 7:01 am
I need to apply the logic below in a sp on SQL Server 2000. I not sure how to code this. Can anyone give me some help? Thanks
(DateOfInterest - 1/1/1970 03:00) *24 *60 *60 *1000 = n
April 13, 2006 at 7:23 am
create procedure sp_tetsproc
as
select datediff(d,dateofinterest,'01/01/1970 03:00')*24*60*60*1000 from mytable
go
this would give you the number of milliseconds between 1/1/1970 03:00 and the field you requested
MVDBA
April 13, 2006 at 7:24 am
but don't quote me - i had a beer at lunchtime, so look up datediff in books on line for hte exact syntax
hic
MVDBA
April 13, 2006 at 7:39 am
Er, I think it might be easier to do
DATEDIFF(ms,DateOfInterest,'19700101 03:00:00')
It doesn't actually give you the same results, though. The original formula gives you the number of milliseconds in the number of days between two dates. My formula also takes into account the difference in times.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply