Convert HH:MM to seconds

D

DF

Sorry...one more question.

How do I convert HH:MM to seconds?

I was using

TSeconds: DateDiff("s",[EIN],[EOut])

but when EIN is, say 19:24 and EOut is 1:05 [24 hour
format], I get negative seconds.

I also have this --- TotalTime: Format([EIN]-[EOUT],"Short
Time") which gives me correct HH:MM in both
circumstances, so if I could get the total seconds from
it, I'd be ok.

Thanks in advance for any help!
Dee
 
W

Wayne Morgan

You can include the date in the field also and Access will then know that the time is from
the next day. Another option, is to add 86,400 seconds (24*60*60) to any negative
response. This will work as long as you never need to go beyond the next day. You could do
this using IIF to check for the negative value.
 
D

DF

Thanks, Wayne...they both worked great! I appreciate the
reply!
Dee
-----Original Message-----
You can include the date in the field also and Access
will then know that the time is from
the next day. Another option, is to add 86,400 seconds (24*60*60) to any negative
response. This will work as long as you never need to go
beyond the next day. You could do
this using IIF to check for the negative value.

--
Wayne Morgan
Microsoft Access MVP


Sorry...one more question.

How do I convert HH:MM to seconds?

I was using

TSeconds: DateDiff("s",[EIN],[EOut])

but when EIN is, say 19:24 and EOut is 1:05 [24 hour
format], I get negative seconds.

I also have this --- TotalTime: Format([EIN]- [EOUT],"Short
Time") which gives me correct HH:MM in both
circumstances, so if I could get the total seconds from
it, I'd be ok.

Thanks in advance for any help!
Dee


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top