If it is a matter of finding the difference between two dates (in milliseconds) you can even run the following query.
DECLARE @d1 DATETIME, @d2 DATETIME
SELECT @d1 = '1/9/2008 11:30:24.123', @d2 = '1/10/2008'
SELECT DATEDIFF(millisecond, @d1, @d2) AS Diff
/*
Diff
-----------
44975877
*/
Or you can extract specific information from the date value using the following query and apply your required calculations.
DECLARE @d1 DATETIME, @d2 DATETIME
SELECT @d1 = '1/9/2008 11:30:24.123'
SELECT
DATEPART(year, @d1) AS Years,
DATEPART(month, @d1) AS Months,
DATEPART(day, @d1) AS Days,
DATEPART(hour, @d1) AS Hours,
DATEPART(minute, @d1) AS Minutes,
DATEPART(second, @d1) AS Seconds,
DATEPART(Millisecond, @d1) AS Milliseconds
/*
Years Months Days Hours Minutes Seconds Milliseconds
----------- ----------- ----------- ----------- ----------- ----------- ------------
2008 1 9 11 30 24 123
*/
.