Online Time Card Calculator

This utility is replaced by an updated version...follow the link.
>> updated free online time sheet calculator <<


After being converted from a salaried to an hourly employee, I found myself wanting to make mid-week evaluations to determine if I was ahead or behind in my accumulation of hours for the week. Because manually performing those calculations can be time consuming and error prone I wrote this time card calculator to help myself. This example uses the JavaScript programming language to create an online time card calculator you can use from a web browser.

If you would like to see how to use JavaScript for similar problem solving I recommend good book, like this one. If you are looking for more time card related resources, click here.

Writing the timecard calculator

Here are the tasks that the calculator will need to tackle.

  1. Get user input for start and stop times and a lunch adjustment.
  2. Convert the start and stop hours into 24 hour format.
  3. Convert the minutes from 60 to 100.
  4. Subtract the converted start time from the converted stop time.
  5. Subtract the lunch adjustment.
  6. Display the total hours.

We'll repeat this process for each day, represented by a row in the calculator below.

The online timecard calculator -- Try Me!

Row Starting Time (HH:MM) Ending Time (HH:MM) Lunch/Breaks(HH:MM) Calculated Total

Notes from JavaScript Time Card Calculator Project

Testing to validate your logic

It's important to define test cases to validate (or invalidate) your approach to solving the problem. Here are the cases I used:

Keywords: javascript time card calculator timecard esqsoft timesheet time sheet calculator 12 hour clock