calculate general time

G

Guest

I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen
 
T

Tom Collins

Jennifer P said:
I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen

Try this:

Function TimeLength(StartTime As Date, EndTime As Date) As String
Dim HourPart As Integer
Dim MinutePart As Integer
HourPart = DateDiff("h", StartTime, EndTime)
MinutePart = DateDiff("n", StartTime, EndTime) - (HourPart * 60)
TimeLength = CStr(HourPart) & ":" & Format(MinutePart, "00")
End Function


Tom Collins
 
G

Guest

Just one more question. Where am I going to insert this code. I was using an
unbound text box to display the time?

Tom Collins said:
Jennifer P said:
I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen

Try this:

Function TimeLength(StartTime As Date, EndTime As Date) As String
Dim HourPart As Integer
Dim MinutePart As Integer
HourPart = DateDiff("h", StartTime, EndTime)
MinutePart = DateDiff("n", StartTime, EndTime) - (HourPart * 60)
TimeLength = CStr(HourPart) & ":" & Format(MinutePart, "00")
End Function


Tom Collins
 
G

Guest

Jen,
In the unbound text box that u want to use for the general time... edit it
and type in =Now()
you can then change the format of date and time that is being shown?

Wonder if this answers ur question?!
Dan


Jennifer P said:
Just one more question. Where am I going to insert this code. I was using an
unbound text box to display the time?

Tom Collins said:
Jennifer P said:
I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen

Try this:

Function TimeLength(StartTime As Date, EndTime As Date) As String
Dim HourPart As Integer
Dim MinutePart As Integer
HourPart = DateDiff("h", StartTime, EndTime)
MinutePart = DateDiff("n", StartTime, EndTime) - (HourPart * 60)
TimeLength = CStr(HourPart) & ":" & Format(MinutePart, "00")
End Function


Tom Collins
 
G

Guest

Dan I am looking to subtracted the begintime from the endtime. However I have
to use the general date format. I am having trouble in figuring out the
=criteria to make it work.

Thanks
Jen

Danbwest said:
Jen,
In the unbound text box that u want to use for the general time... edit it
and type in =Now()
you can then change the format of date and time that is being shown?

Wonder if this answers ur question?!
Dan


Jennifer P said:
Just one more question. Where am I going to insert this code. I was using an
unbound text box to display the time?

Tom Collins said:
I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen

Try this:

Function TimeLength(StartTime As Date, EndTime As Date) As String
Dim HourPart As Integer
Dim MinutePart As Integer
HourPart = DateDiff("h", StartTime, EndTime)
MinutePart = DateDiff("n", StartTime, EndTime) - (HourPart * 60)
TimeLength = CStr(HourPart) & ":" & Format(MinutePart, "00")
End Function


Tom Collins
 
G

Guest

hmm seems like i tricky one, Do u think u cud send the file to me? Create a
copy of it...and delete any infomation u do not want me to see...and send the
file to me...Ill have a play around with it and see if i can get it to work-
if not might be worth trying a few more forums or something. www.asp.net is a
good one!

Dan

Jennifer P said:
Dan I am looking to subtracted the begintime from the endtime. However I have
to use the general date format. I am having trouble in figuring out the
=criteria to make it work.

Thanks
Jen

Danbwest said:
Jen,
In the unbound text box that u want to use for the general time... edit it
and type in =Now()
you can then change the format of date and time that is being shown?

Wonder if this answers ur question?!
Dan


Jennifer P said:
Just one more question. Where am I going to insert this code. I was using an
unbound text box to display the time?

:


I have to time fields [BeginTime] and [EndTime] I need to use the General
Time for the display. I have some ships that will stay for days. What
calculation can I use to display the difference in time (with the 24 hour
turn over)

Thanks in advance....Jen

Try this:

Function TimeLength(StartTime As Date, EndTime As Date) As String
Dim HourPart As Integer
Dim MinutePart As Integer
HourPart = DateDiff("h", StartTime, EndTime)
MinutePart = DateDiff("n", StartTime, EndTime) - (HourPart * 60)
TimeLength = CStr(HourPart) & ":" & Format(MinutePart, "00")
End Function


Tom Collins
 
G

Guest

A friend explained you had to build the module and the use the following
Criteria....

=IIf([EndTime]>0,TimeLength([BeginTime],[EndTime]),0)

Thanks though for the offer
 

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

Similar Threads


Top