getSeconds 메서드
getSeconds 메서드는
날짜 객체에 적용되며
현재 초(秒) 값을 반환합니다
(0부터 59까지의 숫자).
구문
date.getSeconds();
예제
현재 초(秒)를 출력해 봅시다:
let date = new Date();
let res = date.getSeconds();
console.log(res);
함께 보기
-
시(時)를 가져오는 메서드
getHours -
분(分)을 가져오는 메서드
getMinutes -
초(秒)를 가져오는 메서드
getSeconds -
밀리초를 가져오는 메서드
getMilliseconds