toISOString() 예제 - 현재날짜시간 출력
<button onclick="homzzang()">클릭</button> <p id="demo"></p> <script> function homzzang() { var d = new Date(); var n = d.toISOString(); document.getElementById("demo").innerHTML = n; } </script> 결과보기
<button onclick="homzzang()">클릭</button>
<p id="demo"></p>
<script>
function homzzang() {
var d = new Date();
var n = d.toISOString();
document.getElementById("demo").innerHTML = n;
}
</script>
결과보기
결과값: 2019-08-01T09:28:23.694Z
<div id="demo"></div> <script> var demo = document.getElementById('demo'); var date = new Date().toISOString(); var arr = date .substring(0, date.indexOf('T') + 1) .replace('-', '년') .replace('-', '월') .replace('T', '일') .split(''); var str = arr.join('</span><span>'); demo.innerHTML = '<span>'.concat(str).concat('</span>'); </script>
<div id="demo"></div>
var demo = document.getElementById('demo');
var date = new Date().toISOString();
var arr = date
.substring(0, date.indexOf('T') + 1)
.replace('-', '년')
.replace('-', '월')
.replace('T', '일')
.split('');
var str = arr.join('</span><span>');
demo.innerHTML = '<span>'.concat(str).concat('</span>');
배르만 님 (220922) https://sir.kr/qa/474191