you already have your answer -- you just need to display it the way you'd like.datetime values must have both components -- a date AND a time. So, some date must be attached to all values of that datatype. but you can always ignore the date and just display or use the time portion.so, just do your math -- GetDate() - LogOnTime -- and on the results format them as needed. Take parts of the value returned, and adjust as necessary to make 1/1/1900 equal to "0 years, 0 months, 0 days", like this:-- THIS IS SAMPLE DATA FOR YOUdeclare @t table (UserID int, LogOnTime datetime)insert into @tselect 1,'11/23/2004 3:00 AM' unionselect 2,'8/22/2004 7:00 PM' unionselect 3,'1/20/2004 10:12 AM' unionselect 4,'11/23/2003 8:53 AM' unionselect 5,'11/21/2004 11:59 PM'-- HERE IS A SAMPLE SQL STATEMENT select userID, LogOnTime, Year(TimeOn)-1900 as Years, Month(TimeOn)-1 as Months, Day(TimeOn)-1 as Days, DatePart(hh,TimeOn) as Hours, DatePart(mi,TimeOn) as Minutesfrom ( select *, GetDate() - LogOnTime as TimeOn from @t ) a
Does this help?- Jeff