{"id":1809,"date":"2025-01-03T07:49:49","date_gmt":"2025-01-03T07:49:49","guid":{"rendered":"https:\/\/donhit.com\/en\/?p=1809"},"modified":"2025-02-06T01:20:01","modified_gmt":"2025-02-06T01:20:01","slug":"time-and-half","status":"publish","type":"post","link":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/","title":{"rendered":"Time and Half Calculator"},"content":{"rendered":"<p><center> <div class=\"calculator-container\">\r\n        <div class=\"input-section\">\r\n            <h2 style=\"color: #2d3748; margin-bottom: 10px;\">Time and Half Calculator<\/h2>\r\n            <div class=\"input-group\">\r\n                <label for=\"hourlyRate\">Regular Hourly Rate ($)<\/label>\r\n                <input type=\"number\" id=\"hourlyRate\" min=\"0\" step=\"0.01\" placeholder=\"Enter your hourly rate\">\r\n            <\/div>\r\n            <div class=\"input-group\">\r\n                <label for=\"regularHours\">Regular Hours Worked<\/label>\r\n                <input type=\"number\" id=\"regularHours\" min=\"0\" step=\"0.5\" placeholder=\"Enter regular hours worked\">\r\n            <\/div>\r\n            <div class=\"input-group\">\r\n                <label for=\"overtimeHours\">Overtime Hours<\/label>\r\n                <input type=\"number\" id=\"overtimeHours\" min=\"0\" step=\"0.5\" placeholder=\"Enter overtime hours\">\r\n            <\/div>\r\n            <button onclick=\"calculatePay()\">Calculate Pay<\/button>\r\n        <\/div>\r\n\r\n        <div class=\"results\">\r\n            <h3 style=\"color: #2d3748;\">Calculation Results<\/h3>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Regular Pay:<\/span>\r\n                <span class=\"result-value\" id=\"regularPay\">$0.00<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Overtime Pay:<\/span>\r\n                <span class=\"result-value\" id=\"overtimePay\">$0.00<\/span>\r\n            <\/div>\r\n            <div class=\"result-item\">\r\n                <span class=\"result-label\">Total Pay:<\/span>\r\n                <span class=\"result-value\" id=\"totalPay\">$0.00<\/span>\r\n            <\/div>\r\n        <\/div>\r\n\r\n        <div class=\"visual-section\">\r\n            <h3 style=\"color: #2d3748; margin-bottom: 15px;\">Pay Visualization<\/h3>\r\n            <canvas id=\"payChart\"><\/canvas>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n        const canvas = document.getElementById('payChart');\r\n        const ctx = canvas.getContext('2d');\r\n\r\n        \/\/ Set canvas size with higher resolution\r\n        function setCanvasSize() {\r\n            const dpr = window.devicePixelRatio || 1;\r\n            const rect = canvas.getBoundingClientRect();\r\n            canvas.width = rect.width * dpr;\r\n            canvas.height = rect.height * dpr;\r\n            ctx.scale(dpr, dpr);\r\n            canvas.style.width = rect.width + 'px';\r\n            canvas.style.height = rect.height + 'px';\r\n        }\r\n\r\n        window.addEventListener('resize', setCanvasSize);\r\n        setCanvasSize();\r\n\r\n        function drawChart(regularPay, overtimePay) {\r\n            ctx.clearRect(0, 0, canvas.width, canvas.height);\r\n            const total = regularPay + overtimePay;\r\n            if (total === 0) return;\r\n\r\n            const width = canvas.width \/ window.devicePixelRatio;\r\n            const height = canvas.height \/ window.devicePixelRatio;\r\n            const padding = 40;\r\n            const barWidth = (width - padding * 2) \/ 3;\r\n\r\n            \/\/ Draw background grid\r\n            ctx.strokeStyle = '#e2e8f0';\r\n            ctx.lineWidth = 0.5;\r\n            for (let i = 0; i <= 5; i++) {\r\n                const y = padding + (height - padding * 2) * (i \/ 5);\r\n                ctx.beginPath();\r\n                ctx.moveTo(padding, y);\r\n                ctx.lineTo(width - padding, y);\r\n                ctx.stroke();\r\n            }\r\n\r\n            \/\/ Function to draw a bar\r\n            function drawBar(x, height, color, label, value) {\r\n                const barHeight = height * 0.8;\r\n                \r\n                \/\/ Draw bar\r\n                ctx.fillStyle = color;\r\n                ctx.beginPath();\r\n                ctx.roundRect(x, padding + (height - padding * 2) - barHeight, barWidth - 20, barHeight, 8);\r\n                ctx.fill();\r\n\r\n                \/\/ Draw label\r\n                ctx.fillStyle = '#4a5568';\r\n                ctx.font = '14px \"Segoe UI\"';\r\n                ctx.textAlign = 'center';\r\n                ctx.fillText(label, x + (barWidth - 20) \/ 2, height - 10);\r\n\r\n                \/\/ Draw value\r\n                ctx.fillStyle = '#2d3748';\r\n                ctx.font = 'bold 14px \"Segoe UI\"';\r\n                ctx.fillText('$' + value.toFixed(2), x + (barWidth - 20) \/ 2, padding + (height - padding * 2) - barHeight - 10);\r\n            }\r\n\r\n            const maxAmount = Math.max(regularPay, overtimePay, total);\r\n            const scale = (height - padding * 2) \/ maxAmount;\r\n\r\n            \/\/ Draw bars\r\n            drawBar(padding, height, 'rgba(66, 153, 225, 0.8)', 'Regular', regularPay);\r\n            drawBar(padding + barWidth, height, 'rgba(236, 201, 75, 0.8)', 'Overtime', overtimePay);\r\n            drawBar(padding + barWidth * 2, height, 'rgba(72, 187, 120, 0.8)', 'Total', total);\r\n        }\r\n\r\n        function calculatePay() {\r\n            const hourlyRate = parseFloat(document.getElementById('hourlyRate').value) || 0;\r\n            const regularHours = parseFloat(document.getElementById('regularHours').value) || 0;\r\n            const overtimeHours = parseFloat(document.getElementById('overtimeHours').value) || 0;\r\n\r\n            const regularPay = hourlyRate * regularHours;\r\n            const overtimePay = hourlyRate * 1.5 * overtimeHours;\r\n            const totalPay = regularPay + overtimePay;\r\n\r\n            document.getElementById('regularPay').textContent = '$' + regularPay.toFixed(2);\r\n            document.getElementById('overtimePay').textContent = '$' + overtimePay.toFixed(2);\r\n            document.getElementById('totalPay').textContent = '$' + totalPay.toFixed(2);\r\n\r\n            drawChart(regularPay, overtimePay);\r\n\r\n            \/\/ Add animation effect to results\r\n            const results = document.querySelectorAll('.result-value');\r\n            results.forEach(result => {\r\n                result.style.animation = 'none';\r\n                result.offsetHeight; \/\/ Trigger reflow\r\n                result.style.animation = 'highlight 1s ease-out';\r\n            });\r\n        }\r\n\r\n        \/\/ Initial chart draw\r\n        drawChart(0, 0);\r\n    <\/script><\/center><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[184],"tags":[],"class_list":["post-1809","post","type-post","status-publish","format-standard","hentry","category-calculator"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.0 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Time and Half Calculator - DonHit<\/title>\n<meta name=\"description\" content=\"Using a time and half calculator ensures precise calculations of overtime pay based on hourly rates and specific overtime rates mandated by wage laws\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/donhit.com\/en\/calculator\/time-and-half\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Time and Half Calculator - DonHit\" \/>\n<meta property=\"og:description\" content=\"Using a time and half calculator ensures precise calculations of overtime pay based on hourly rates and specific overtime rates mandated by wage laws\" \/>\n<meta property=\"og:url\" content=\"https:\/\/donhit.com\/en\/calculator\/time-and-half\/\" \/>\n<meta property=\"og:site_name\" content=\"DonHit - World of Tools\" \/>\n<meta property=\"article:published_time\" content=\"2025-01-03T07:49:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-02-06T01:20:01+00:00\" \/>\n<meta name=\"author\" content=\"DonHit\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DonHit\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Time and Half Calculator - DonHit","description":"Using a time and half calculator ensures precise calculations of overtime pay based on hourly rates and specific overtime rates mandated by wage laws","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/","og_locale":"en_US","og_type":"article","og_title":"Time and Half Calculator - DonHit","og_description":"Using a time and half calculator ensures precise calculations of overtime pay based on hourly rates and specific overtime rates mandated by wage laws","og_url":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/","og_site_name":"DonHit - World of Tools","article_published_time":"2025-01-03T07:49:49+00:00","article_modified_time":"2025-02-06T01:20:01+00:00","author":"DonHit","twitter_card":"summary_large_image","twitter_misc":{"Written by":"DonHit","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/#article","isPartOf":{"@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/"},"author":{"name":"DonHit","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"headline":"Time and Half Calculator","datePublished":"2025-01-03T07:49:49+00:00","dateModified":"2025-02-06T01:20:01+00:00","mainEntityOfPage":{"@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/"},"wordCount":10,"commentCount":0,"publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"articleSection":["Calculator"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/donhit.com\/en\/calculator\/time-and-half\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/","url":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/","name":"Time and Half Calculator - DonHit","isPartOf":{"@id":"https:\/\/donhit.com\/en\/#website"},"datePublished":"2025-01-03T07:49:49+00:00","dateModified":"2025-02-06T01:20:01+00:00","description":"Using a time and half calculator ensures precise calculations of overtime pay based on hourly rates and specific overtime rates mandated by wage laws","breadcrumb":{"@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/donhit.com\/en\/calculator\/time-and-half\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/donhit.com\/en\/calculator\/time-and-half\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Trang ch\u1ee7","item":"https:\/\/donhit.com\/en\/"},{"@type":"ListItem","position":2,"name":"Calculator","item":"https:\/\/donhit.com\/en\/category\/calculator\/"},{"@type":"ListItem","position":3,"name":"Time and Half Calculator"}]},{"@type":"WebSite","@id":"https:\/\/donhit.com\/en\/#website","url":"https:\/\/donhit.com\/en\/","name":"DonHit - World of tools","description":"","publisher":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/donhit.com\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/0c6ff7dcd8ba4810c56a532f09c33148","name":"DonHit","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/","url":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","contentUrl":"https:\/\/donhit.com\/en\/wp-content\/uploads\/2024\/11\/logo-donhit.webp","width":400,"height":267,"caption":"DonHit"},"logo":{"@id":"https:\/\/donhit.com\/en\/#\/schema\/person\/image\/"},"description":"DonHit is a website designed to provide useful tools for everyone. Its primary goal is to support and empower the community. All the tools available on the site are completely free to use.","sameAs":["https:\/\/donhit.com\/en"],"url":"https:\/\/donhit.com\/en\/author\/admin_don\/"}]}},"_links":{"self":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1809","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/comments?post=1809"}],"version-history":[{"count":2,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1809\/revisions"}],"predecessor-version":[{"id":2027,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/posts\/1809\/revisions\/2027"}],"wp:attachment":[{"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/media?parent=1809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/categories?post=1809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/donhit.com\/en\/wp-json\/wp\/v2\/tags?post=1809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}