Loc Posted October 18, 2020 Posted October 18, 2020 I'm a bit weak in terms of calculation Can you give me an example of how to calculate the hourly rate. For example: from 18:00 to 19:00 is 1 hour. Here 1 hour = 1000 money. Counting from the start time to the end time is how many minutes and calculating the money, the better.
TheXman Posted October 18, 2020 Posted October 18, 2020 (edited) 8 hours ago, Loc said: I'm a bit weak in terms of calculation Can you give me an example of how to calculate the hourly rate. I assume that you meant how to calculate the gross wages since you said "1 hour = 1000 money". Use _DateDiff to calculate the number of minutes between start and end times Divide minutes by 60 to get hours Multiply hours times hourly rate to calculate gross wages #include <Constants.au3> #include <Date.au3> Const $HOURLY_RATE = 1000.00, _ $START_TIME = '2020-10-18 23:00', _ $END_TIME = '2020-10-19 06:30' Global $fHours = _DateDiff('n', $START_TIME, $END_TIME) / 60 Global $fWages = $fHours * $HOURLY_RATE MsgBox($MB_ICONINFORMATION+$MB_TOPMOST, "Wages", _ StringFormat("Start = %s\nEnd = %s\n\nHours = %.2f\nRate = %.2f\n\nWages = %.2f", _ $START_TIME, $END_TIME, $fHours, $HOURLY_RATE, $fWages)) Edited October 18, 2020 by TheXman Updated example JockoDundee 1 CryptoNG UDF: Cryptography API: Next Gen jq UDF: Powerful and Flexible JSON Processor | jqPlayground: An Interactive JSON Processor Xml2Json UDF: Transform XML to JSON | HttpApi UDF: HTTP Server API | Roku Remote: Example Script About Me How To Ask Good Questions On Technical And Scientific Forums (Detailed) | How to Ask Good Technical Questions (Brief) "Any fool can know. The point is to understand." -Albert Einstein "If you think you're a big fish, it's probably because you only swim in small ponds." ~TheXman
Loc Posted October 19, 2020 Author Posted October 19, 2020 (edited) My intention is to write internet checkout tools. Start timing from what time it will run incrementally up to the current time. I searched and found no one who posted this topic. thanks Edited October 19, 2020 by Loc
JockoDundee Posted October 19, 2020 Posted October 19, 2020 16 hours ago, TheXman said: Use _DateDiff to calculate the number of minutes between start and end times Divide minutes by 60 to get hours Multiply hours times hourly rate to calculate gross wages Agree, although if we’re talking about actual wages paid in the U.S. to physically present employees, you might need a rounding option to the quarter hour, as it is both a legal and still common way of paying people “on the clock”, though less so these days. Complicating matters somewhat is the fact that rounding usually occurs on both ends of the punch, e.g. 9:08 to 5:07 can be, and often is paid out as 8.75 hours, though of course the opposite can occur. I remember many a time waiting by the clock for the 8th click before getting an exit punch; though this was obviously frowned upon Code hard, but don’t hard code...
Recommended Posts
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