Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Difference between Times with dates

Author  Topic 

asif372
Posting Yak Master

100 Posts

Posted - 2013-01-27 : 05:57:36
i want disserence between 2 datetime fields
how can it be possible
my data is like this

ID---- Timein------------------- TimeOut----------------
1-----2013-10-13 08:27:00.000--- 2013-10-13 16:12:00.000
2-----2013-10-14 18:00:00.000--- 2013-10-15 05:00:00.000
3-----2013-10-14 19:00:00.000--- 2013-10-15 07:00:00.000
4-----2013-10-14 19:15:00.000--- 2013-10-15 10:18:00.000
5-----2013-10-15 18:10:00.000--- 2013-10-16 06:55:00.000
5-----2013-10-15 19:10:00.000--- 2013-10-16 07:40:00.000

i want difference between Timein and Time Out as above data show's date change between timein and timeout how can it be possible
Thanks in advance

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2013-01-27 : 07:04:02
you can use DATEDIFF()


Too old to Rock'n'Roll too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-01-27 : 13:52:43
you want date difference in what format? Show your expected output for above data

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -