A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.cdn.mozilla.net/ko/docs/Web/JavaScript/Reference/Global_Objects/Date/getHours below:

Date.prototype.getHours() - JavaScript | MDN

Date.prototype.getHours()

Baseline Widely available

getHours() 메서드는 주어진 날짜의 현지 시간 기준 시를 반환합니다.

시도해 보기
const birthday = new Date("March 13, 08 04:20");

console.log(birthday.getHours());
// Expected output: 4
구문 반환 값

주어진 날짜의 현지 시간 기준 시를 나타내는 0에서 23 사이의 정수.

예제 getHours() 사용하기

아래의 두 번째 명령문은 Date 객체 Xmas95 날짜의 시를 hours 변수에 할당합니다.

var Xmas95 = new Date("December 25, 1995 23:15:30");
var hours = Xmas95.getHours();

console.log(hours); // 23
명세 브라우저 호환성 같이 보기

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4