WEBLEB
होम
संपादक
लॉग इन करें
Pro
हिंदी
English
Français
Español
Português
Deutsch
Italiano
हिंदी
दिनांक कैलकुलेटर
1028
styx125
संपादक में खोलें
अपना कोड प्रकाशित करें
क्या आपको एक वेबसाइट चाहिए?
अनुशंसित
27 March 2025
बीएमआई कैलकुलेटर
29 July 2024
आईफोन कैलकुलेटर
15 October 2024
आईओएस कैलकुलेटर
HTML
Copy
Datum Rechner
Datum
Von
Bis
Differenz
Jahre:
0
Monate:
0
Tage:
0
Total Days:
0
Berechnen
CSS
Copy
body { font-family: Arial, sans-serif; background-color: #121212; color: #ffffff; display: flex; justify-content: center; align-items: center; height: 100vh; margin: 0; } .container { text-align: center; background-color: #1f1f1f; padding: 20px; border-radius: 10px; } h1, h2 { margin: 10px 0; color: #f66b0e; } .date-inputs { display: flex; justify-content: space-around; margin: 20px 0; } .date-inputs label, .date-inputs input { margin: 0 10px; color: #ffffff; } .result { background-color: #262626; padding: 20px; border-radius: 10px; } button { background-color: #f66b0e; color: #ffffff; border: none; padding: 10px 20px; margin-top: 20px; cursor: pointer; border-radius: 5px; } button:hover { background-color: #e65a00; } input { -webkit-text-fill-color: #f66b0e; }
JS
Copy
function calculateDifference() { const startDate = new Date(document.getElementById('start-date').value); const endDate = new Date(document.getElementById('end-date').value); if (isNaN(startDate) || isNaN(endDate)) { alert('Bitte geben Sie gültige Daten ein.'); return; } const diffTime = Math.abs(endDate - startDate); const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)); let years = Math.floor(diffDays / 365); let months = Math.floor((diffDays % 365) / 30); let days = (diffDays % 365) % 30; document.getElementById('years').textContent = years; document.getElementById('months').textContent = months; document.getElementById('days').textContent = days; document.getElementById('total-days').querySelector('span').textContent = diffDays; }