By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,493 Members | 1,209 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,493 IT Pros & Developers. It's quick & easy.

How to get the Difference Between Two Time Fields?

pravipravi
P: 16
Actually i am using two time values.But they are created as Date and time format.Keeping that format i want to find the Time deffrence between InTime and OutTime.As do the job normally i got a 0.30658874 as answer.How can i make the diffrence?That is Outtime-InTime form tblHistory?
Feb 24 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
Actually i am using two time values.But they are created as Date and time format.Keeping that format i want to find the Time deffrence between InTime and OutTime.As do the job normally i got a 0.30658874 as answer.How can i make the diffrence?That is Outtime-InTime form tblHistory?
Expand|Select|Wrap|Line Numbers
  1. TimeSerial(0,DateDiff("n",[InTime],[OutTime]),0)
Try this.

Mary
Feb 24 '07 #2

MSeda
Expert 100+
P: 159
multiply by 24. Even though the format only shows time it's still calculated as time and date.
Feb 25 '07 #3

NeoPa
Expert Mod 15k+
P: 31,186
As MSeda says, the result you got is actually quite correct and refers to a fractional portion of a day. To get the days from this use :
Expand|Select|Wrap|Line Numbers
  1. Format(OutTime - InTime, "0")
To get the fractional portion use :
Expand|Select|Wrap|Line Numbers
  1. Format(OutTime - InTime, "HH:nn:ss")
Feb 26 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.