PDA

Click to See Complete Forum and Search --> : [RESOLVED] change the start stop time depending on list1 value


rajrbr
Apr 29th, 2010, 10:23 PM
iam doing a project auto datalogger.

i have list1 ( auto /manual)

i have start time text box
and finish time test box

and cmdstart and cmstop.
my requirement is
1) when i click cmdstart and if the list1=auto
i want start time = time eg ( 8:45:01 am)
finishtime= time+3 hours (11:45:01 am)
and the cmdstop should occur at 11:45:01 am

2) if list1=manual
then only start time should be displayed
and when cmdstop clicked it should display stop time.

means if the list is auto start and finish time are of 3 hours diffrence.and if it is in manual mode finish time should be logged after clicking cmdstop.

many thanks in advace

jemidiah
Apr 30th, 2010, 03:42 AM
Most of your question isn't about math. Using VB6, the easiest way to get a timer is using the GetTickCount API call, which returns the number of milliseconds since the system was started.


StartTime = GetTickCount()
...
EndTime = GetTickCount()


To convert from milliseconds to hours/minutes/seconds, do the following:


'timeMS = input time in milliseconds
timeMS = Val(InputBox("timeMS = ", , CStr(timeMS)))
timeS = Int(timeMS / 1000)
timeMin = Int(timeS / 60)
timeH = Int(timeMin / 60)
MsgBox "hours = " & timeH Mod 24 & ", minutes = " & timeMin Mod 60 & ", seconds = " & timeS Mod 60

If you have coding questions, they should be in the appropriate coding forum. Any coder there should easily be able to understand this code. Depending on your system, you can add the time between EndTime and StartTime to the system time at StartTime, though that's another coding issue so I won't go into it.

rajrbr
Apr 30th, 2010, 05:51 AM
hello
Jemidia

i want start time and stop time should be of 3 hours diffrence.and should be called based on list1 value.
if its auto start time = time and finish time should be 3hours+starttime.

regards
raj

jemidiah
Apr 30th, 2010, 07:19 AM
Please ask the above question in the appropriate programming forum. Point them to this thread for the number conversion. I won't help with a coding question that's, to be honest, this simple, where most of the "help" will be getting you to give enough detail to answer your question properly. Good luck.