Login
Сколько не работал программист Борат - 7495 дней! ЯваСкрипт
4528 просмотров
Перейти к просмотру всей ветки
На прошлой неделе произошло торжественное событие, Борат не работал 7495 дней! Палец о палец не написал на [size=+2]Solidity![size]
Но как подсчитать нужную дату, к нашему счастью ЯваСкрипт такое может, вот страница: страна.де/борат-не-работал.хтмл
Объяснение - кнопка Рефреш - это кнопка обновление, к тому времени прибавляется ещё пару минут неработания программиста.
[code]
| <h2>Borat hat nicht gearbeitet:</h2> | |
| <script> | |
| const startDate = new Date('2004-04-01T00:00:00'); | |
| const endDate = Date.now(); | |
| const timeDifferenceMS = endDate - startDate; | |
| const timeDifferenceSekunden = Math.floor(timeDifferenceMS / 1000); | |
| const timeDifferenceMinuten = Math.floor(timeDifferenceMS / 60000); | |
| const timeDifferenceStunden = Math.floor(timeDifferenceMS / 3600000); | |
| const timeDifferenceTage = Math.floor(timeDifferenceMS / 86400000); | |
| const timeDifferenceWoche = Math.floor(timeDifferenceMS / 604800000); | |
| const timeDifferenceMonat = Math.floor(timeDifferenceMS / 2628000000); | |
| const timeDifferenceJahr = Math.floor(timeDifferenceMS / 31557600000); | |
| document.write( | |
| "<h1>" + timeDifferenceJahr + " Jahren" + "</h1>" + "<br>" | |
| + " oder " + timeDifferenceMonat + " Monate" + "<br>" | |
| + " oder " + timeDifferenceWoche + " Wochen" + "<br>" | |
| + " oder " + timeDifferenceTage + " Tagen" + "<br>" | |
| + " oder " + timeDifferenceStunden + " Wochen" + "<br>" | |
| + " oder " + timeDifferenceMinuten + " Minuten" + "<br>" | |
| + " oder " + timeDifferenceSekunden + " Sekunden" + "<br>" | |
| + " oder " + timeDifferenceMS + " Millisekunden" + "<br>") | |
| function refresh(){ | |
| window.location.reload() | |
| } | |
| </script> | |
| <br><br><br> | |
| <button class="form-submit btn" onClick="refresh()">Refresh</button> | |
[/code]


Fragen und Antworten - Программируем калькулятор пособий для беженцев вместе.
Zurück