.wh-calc-container {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
max-width: 800px;
margin: 20px auto;
padding: 25px;
border: 1px solid #e0e0e0;
border-radius: 12px;
background-color: #ffffff;
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
color: #333;
}
.wh-calc-header {
text-align: center;
margin-bottom: 30px;
}
.wh-calc-header h2 {
color: #1a73e8;
margin-bottom: 10px;
}
.wh-day-row {
display: grid;
grid-template-columns: 1fr 1.5fr 1.5fr 1fr;
gap: 10px;
align-items: center;
padding: 12px 0;
border-bottom: 1px solid #f0f0f0;
}
.wh-day-row:last-child {
border-bottom: none;
}
.wh-day-label {
font-weight: 600;
color: #555;
}
.wh-input-group {
display: flex;
flex-direction: column;
}
.wh-input-group label {
font-size: 11px;
color: #888;
margin-bottom: 4px;
text-transform: uppercase;
}
.wh-calc-container input {
padding: 8px;
border: 1px solid #ccc;
border-radius: 4px;
font-size: 14px;
}
.wh-settings {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin-top: 25px;
padding: 20px;
background-color: #f8f9fa;
border-radius: 8px;
}
.wh-button {
display: block;
width: 100%;
background-color: #1a73e8;
color: white;
border: none;
padding: 15px;
font-size: 18px;
font-weight: bold;
border-radius: 6px;
cursor: pointer;
margin-top: 20px;
transition: background-color 0.2s;
}
.wh-button:hover {
background-color: #1557b0;
}
.wh-results {
margin-top: 30px;
padding: 20px;
background-color: #e8f0fe;
border-radius: 8px;
text-align: center;
}
.wh-result-grid {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 15px;
margin-top: 15px;
}
.wh-result-item {
background: white;
padding: 15px;
border-radius: 6px;
box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.wh-result-val {
font-size: 24px;
font-weight: bold;
color: #1a73e8;
display: block;
}
.wh-result-label {
font-size: 13px;
color: #666;
}
.wh-article {
margin-top: 40px;
line-height: 1.6;
}
.wh-article h3 {
color: #222;
border-left: 4px solid #1a73e8;
padding-left: 10px;
margin-top: 25px;
}
@media (max-width: 600px) {
.wh-day-row {
grid-template-columns: 1fr 1fr;
}
.wh-settings, .wh-result-grid {
grid-template-columns: 1fr;
}
}
How to Calculate Weekly Work Hours
Calculating your weekly work hours accurately is essential for ensuring you are paid correctly and for maintaining a healthy work-life balance. Whether you are an hourly employee, a freelancer, or a manager tracking staff time, manual calculations can lead to errors, especially when subtracting breaks or calculating overtime.
To calculate hours manually, follow these steps:
- Convert Time to 24-Hour Format: This avoids confusion between AM and PM (e.g., 1:00 PM becomes 13:00).
- Subtract Start Time from End Time: For example, 17:00 minus 09:00 equals 8 hours.
- Subtract Unpaid Breaks: If you take a 30-minute unpaid lunch, subtract 0.5 hours from your daily total.
- Convert Minutes to Decimals: To add hours easily, convert minutes by dividing them by 60 (e.g., 15 mins = 0.25 hours, 30 mins = 0.5 hours, 45 mins = 0.75 hours).
Understanding Overtime and Pay
In many regions, including the United States under the Fair Labor Standards Act (FLSA), the standard workweek is 40 hours. Any time worked beyond this threshold is often considered "Overtime" and is typically paid at 1.5 times the regular hourly rate (Time and a Half).
Example Calculation:
If you work 45 hours in a week at a rate of $20/hour:
– Regular Pay: 40 hours × $20 = $800
– Overtime Pay: 5 hours × ($20 × 1.5) = $150
– Total Gross Pay: $950
Why Use a Weekly Hours Calculator?
Using a digital tool eliminates the risk of "math fatigue." Our calculator handles complex time-crossing (such as night shifts) and ensures that break deductions are precise. It is particularly useful for:
- Freelancers: Tracking billable hours for multiple clients.
- Shift Workers: Verifying that timesheets match actual hours worked.
- Small Business Owners: Quickly estimating weekly payroll costs before processing.
function calculateWeeklyHours() {
var days = ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'];
var totalHours = 0;
for (var i = 0; i < days.length; i++) {
var start = document.getElementById(days[i] + '_start').value;
var end = document.getElementById(days[i] + '_end').value;
var breakMin = parseFloat(document.getElementById(days[i] + '_break').value) || 0;
if (start && end) {
var startTime = new Date("1970-01-01T" + start + "Z");
var endTime = new Date("1970-01-01T" + end + "Z");
// Handle night shifts (end time earlier than start time)
if (endTime 0) {
totalHours += dailyTotal;
}
}
}
var rate = parseFloat(document.getElementById('hourly_rate').value) || 0;
var threshold = parseFloat(document.getElementById('ot_threshold').value) || 40;
var overtimeHours = 0;
var regularHours = totalHours;
if (totalHours > threshold) {
overtimeHours = totalHours – threshold;
regularHours = threshold;
}
var grossPay = (regularHours * rate) + (overtimeHours * rate * 1.5);
// Update UI
document.getElementById('res_total_hours').innerText = totalHours.toFixed(2);
document.getElementById('res_overtime').innerText = overtimeHours.toFixed(2);
document.getElementById('res_gross_pay').innerText = '$' + grossPay.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 2});
document.getElementById('results_box').style.display = 'block';
// Smooth scroll to results
document.getElementById('results_box').scrollIntoView({ behavior: 'smooth', block: 'nearest' });
}