250x250
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| 8 | 9 | 10 | 11 | 12 | 13 | 14 |
| 15 | 16 | 17 | 18 | 19 | 20 | 21 |
| 22 | 23 | 24 | 25 | 26 | 27 | 28 |
| 29 | 30 | 31 |
Tags
- SWIFT
- hover
- 프론트엔드
- iOS 개발자
- MAC
- ipad
- react
- iPhone
- keyframes
- html5
- css3
- front-end
- CSS
- jQuery
- IOS
- Animation
- 백엔드
- javascript
- 자바스크립트
- HTML
- 비전공자
- button
- 비전공 개발자
- 개발자
- 풀스택
- image
- effect
- php
- 애니메이션
- xcode
Archives
- Today
- Total
비전공자 개발일기
Javascript Clock 본문
728x90
SMALL
<h2 id="date"></h2>
<h2 id="clock">00:00:00</h2>
const clock = document.querySelector("h2#clock");
function getClock() {
const date = new Date();
const hours = String(date.getHours()).padStart(2, "0");
const minutes = String(date.getMinutes()).padStart(2, "0");
const seconds = String(date.getSeconds()).padStart(2, "0");
clock.innerText = `${hours}:${minutes}:${seconds}`;
}
getClock();
setInterval(getClock, 1000);728x90
LIST
'Javascript' 카테고리의 다른 글
| Javascript NaN (0) | 2021.09.01 |
|---|---|
| HTML JAVASCRIPT Select option Multiple (0) | 2021.08.27 |
| Javascript Login with LocalStorage (0) | 2021.08.25 |
| Javascript (0) | 2021.08.16 |
| Javascript (0) | 2021.08.14 |