This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<h1>utc text 입력</h1> | |
시작시간: <input type="text" id="startInput"></input> | |
</br> | |
끝시간: <input type="text" id="textInput"></input> | |
</br> | |
<button id="inputBtn">변환</button> | |
<div id="result"><div> | |
</html> | |
<script> | |
const textInput = document.getElementById('textInput') | |
const inputBtn = document.getElementById('inputBtn') | |
const startInput = document.getElementById('startInput') | |
const result = document.getElementById('result') | |
inputBtn.addEventListener('click', (e) => { | |
const start = new Date(startInput.value) | |
console.log(startInput.value, start) | |
const d = new Date(textInput.value) | |
console.log(textInput.textContent, d) | |
result.textContent = `${textInput.value} = ${d.toLocaleString()}\n ${new Date(d-start).toISOString().substr(11, 8)}` | |
}) | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment