--- title: Date.prototype.setHours() slug: Web/JavaScript/Reference/Global_Objects/Date/setHours tags: - Date - JavaScript - Method - Prototype translation_of: Web/JavaScript/Reference/Global_Objects/Date/setHours original_slug: Web/JavaScript/Referencje/Obiekty/Date/setHours ---
{{JSRef}}
Ustawia godziny dla określonej daty stosownie do czasu lokalnego.
dateObj.setHours(hoursValue[, minutesValue[, secondsValue[, msValue]]])
dateObj.setHours(hoursValue)
hoursValue minutesValue secondsValue secondsValue, musisz także określić minutesValue.msValue msValue, musisz także określić minutesValue i secondsValue.Jeśli nie określisz parametrów minutesValue, secondsValue i msValue, wartość zwracana użytych metod {{jsxref("Date.prototype.getMinutes()", "getMinutes()")}}, {{jsxref("Date.prototype.getSeconds()", "getSeconds()")}} i {{jsxref("Date.prototype.getMilliseconds()", "getMilliseconds()")}}.
Jeśli Twój parametr jest określony z poza szeregu, setHours próbuje zaktualizować informacje o dacie w obiekcie {{jsxref("Date")}}. Na przykład, jeśli użyjesz wartości 100 dla secondsValue, minuty będą wzrastać o 1 (min + 1), i wartość 40 będzie użyta dla sekund.
setHours()var the BigDay = new Date(); theBigDay.setHours(7);