Monday, December 12, 2011

Display the how many day's ,hours,minites and seconds using sql server


select
DATEDIFF(day,2007-11-30,2007-11-20) AS NumberOfDays,
DATEDIFF(hour,2007-11-30,2007-11-20) AS NumberOfHours,
DATEDIFF(minute,'2011-12-12 05:43:06.007','2011-12-12 05:45:12.100') AS NumberOfMinutes,
DATEDIFF(second,'2011-12-12 05:45:06.007','2011-12-12 05:45:06.007') AS NumberOfSecond

No comments:

Post a Comment