DECLARE @TotalSec int
DECLARE @DiffSecs int
SET @TotalSec = 24*60*60
SELECT
--DATEDIFF(SECOND, Created_Date, getdate()),
CASE
WHEN CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) > 0 THEN
CAST(CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec))AS VARCHAR)+' Day'+' '
+
CAST(CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600))AS VARCHAR)+' Hr'
WHEN CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600)) > 0 And CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) <= 0 THEN
CAST(CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600))AS VARCHAR)+' Hr' +' '
+CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60))AS VARCHAR)+' min'
WHEN CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60)) > 0 And CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600)) <= 0 And CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) <= 0 THEN
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60))AS VARCHAR)+' min'
+' '+
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)%60)) AS VARCHAR)+' Sec'
Else
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)%60)) AS VARCHAR)+' Sec'
End As Time_toNoti
DECLARE @DiffSecs int
SET @TotalSec = 24*60*60
SELECT
--DATEDIFF(SECOND, Created_Date, getdate()),
CASE
WHEN CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) > 0 THEN
CAST(CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec))AS VARCHAR)+' Day'+' '
+
CAST(CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600))AS VARCHAR)+' Hr'
WHEN CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600)) > 0 And CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) <= 0 THEN
CAST(CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600))AS VARCHAR)+' Hr' +' '
+CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60))AS VARCHAR)+' min'
WHEN CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60)) > 0 And CONVERT(char(2), ((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)/3600)) <= 0 And CONVERT(char(2), (DATEDIFF(SECOND, Created_Date, getdate())/@TotalSec)) <= 0 THEN
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)/60))AS VARCHAR)+' min'
+' '+
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)%60)) AS VARCHAR)+' Sec'
Else
CAST(CONVERT(char(2), (((DATEDIFF(SECOND, Created_Date, getdate())%@TotalSec)%3600)%60)) AS VARCHAR)+' Sec'
End As Time_toNoti
Comments
Post a Comment