Hello all. I have a user input 2 times per day, just the hour, (EX: 12 am or pm, 4 am or pm) I need help determining the total hours. For example: if a user enters 10 am, and 7 am, I need to determine 21 hours. Has anybody ever had to code something like this?
Platform: RS5000
Regards,
JF
It is simple comparing
Easier if you change time values to 24hour format for calculation.
start_time: time 0..12 am or pm
stop time: time 0..12 am or pm
am_pm_start_sel: false = am, true = pm selected
am_pm_stop_sel: false = am, true = pm selected
if start time and am_pm_start_sel=false then
start time_temp:=start_time
end_if
if start time and am_pm_start_sel=true then
start time_temp:=start_time+12
end_if
if stop time and am_pm_start_sel=false then
stop time_temp:=stop_time
end_if
if stop time and am_pm_start_sel=true then
stop time_temp:=stop_time+12
end_if
if start_time_temp>stop_time_temp then
time_dif:=(24-start_time_temp)-stop_time_temp
end_if
if start_time_temp<=stop_time_temp then
time_dif:=stop_time_temp-start_time_temp
end_if