Introduction:
In this article I will explain how to get time difference between two dates in SQL server.
In this article I will explain how to get time difference between two dates in SQL server.
Description:
In
previous articles I explained SQL DATEDIFF Function to show date difference in days, difference between function and stored
procedures,
joins in SQL Server, substring function in SQL server
and many articles relating to SQL
server.
Now I will explain how to get time difference between two dates in SQL
server.
DECLARE @Sdate DATETIME, @Edate DATETIME, @Timediff VARCHAR(100)
SELECT @Sdate = '02/12/2014 08:40:18.000',@Edate='02/13/2014 09:52:48.000'
SET @Timediff=DATEDIFF(s, @Sdate, @Edate)
SELECT CONVERT(VARCHAR(5),@Timediff/3600)+':'+convert(varchar(5),@Timediff%3600/60)+':'+convert(varchar(5),@Timediff%60) AS TimeDiff
|
Once
we run above query we will get output like as shown below
Output:
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
7 comments :
nice article..........
sir, how to translate words English to Hindi.. like
http://transliteration.yahoo.com/hindi/
in asp.net / vb.net
Thanks
how to use in web forms FolderBrowserDialog?.. i want to store folder information in database, not a file information.. Ex. "C:\Data"
really a great post................
Free Summer Training Companies
Thanks.........
Nice one....helpful...
Note: Only a member of this blog may post a comment.