JavaScript Tarihi getUTCHours()
Örnekler
UTC saatlerini alın:
const d = new Date();
let hour = d.getUTCHours();
UTC saatlerini belirli bir tarihten alın:
const d = new Date("July 21, 1983 01:15:00");
let hour = d.getUTCHours();
Aşağıda daha fazla örnek.
Tanım ve Kullanım
getUTCHours()
bir tarihin saatini (0 - 23) döndürür.
getUTCHours()
UTC'ye göre saati döndürür.
notlar
UTC (Evrensel Saat Koordineli), Dünya Saati Standardı tarafından belirlenen saattir.
UTC saati GMT saati (Greenwich Ortalama Saati) ile aynıdır.
Tüm JavaScript getUTC yöntemleri, tarihin yerel saat olduğunu varsayar.
Sözdizimi
Date.getUTCHours()
parametreler
YOK |
Geri dönüş değeri
Bir sayı. Bir tarihin saati (0 - 23). |
Tarayıcı Desteği
getUTCHours()
bir ECMAScript1 (ES1) özelliğidir.
ES1 (JavaScript 1997) tüm tarayıcılarda tam olarak desteklenir:
Chrome | IE | Edge | Firefox | Safari | Opera |
Yes | Yes | Yes | Yes | Yes | Yes |
Daha fazla örnek
Evrensel saati görüntülemek için tüm getUTC yöntemlerini kullanın:
function addZero(i) {
if (i < 10) {i = "0" + i}
return i;
}
const d = new Date();
let h = addZero(d.getUTCHours());
let m = addZero(d.getUTCMinutes());
let s = addZero(d.getUTCSeconds());
let time = h + ":" + m + ":" + s;