habitude Posted October 16, 2002 Posted October 16, 2002 slight time calulation issue... and maybe I'm off base about this theory.. A senario: lets say it takes 5 separate processes (or steps) to complete a job. The job is scheduled to start at 0800 hrs but a tech doesn't clock in on that job until 1300 hrs. By 1700 hrs (and end of work day), the job is not finished, until 1000 hrs the next day. *note* - the first goal is to find how many days, start to finish for each step, and all steps combined. the second is to track hours. All fields (s-date, s-time, f-time, f-date) are currently in place and working for each step. Here is the unknown... given this illustration, we assume that when the step in finished, it took 6 hours for the tech to complete the task. Because the job didn't finish until 1000 the next morning, has 10 hours (1 "work day" + 2 hrs) has already elapsed or just 6? whatever the the answer, how do I modify my fields to calc hours from 2 separate days? Does this make any sense? lol
Vaughan Posted October 16, 2002 Posted October 16, 2002 You are on the right track when you state the second step requires s-date, s-time, f-time, f-date information. If you record the start date and time and finish date and time, it'll sort itself out if you do the calculation correctly. The calculation first needs to work out how many "days" the job took using the dates... fdate - sdate Note that this will result in a number of days so we convert this to hours... (fdate - sdate) * 24 Then the calculation works out how many "hours" the job took using the times. Note that times are stored as seconds so we need to divide by 3600 to convert to hours... ((fdate - sdate) * 24) + ((ftime - stime) / 3600) In your case above, the ftime is smaller than the stime so it will result in a negative number of hours.
Recommended Posts
This topic is 8145 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now