Quantcast
Channel: SQLServerCentral » SQL Server 2012 » SQL Server 2012 - T-SQL » Latest topics
Viewing all articles
Browse latest Browse all 4901

DATEDIFF with days and hours

$
0
0
Hi guys, I am trying to calculate the diffs between to days as a decimal. The hours will an easier wayybe in decimal.i can do it in varchar, but i need to be able to agrigate my value.eg. datediff(DD, [CreatedOn],getdate()) + CAST(DATEPART(HH, GETDATE())- DATEPART(HH, [CreatedOn]) AS REAL)/10this gives me the results i need.is there an easier way?

Viewing all articles
Browse latest Browse all 4901

Trending Articles