Sets the date's hours

Description

setHours(hours)
Sets the date's hours. Setting the hours to a number greater than 23 also increments the day of the month.

Example


      var myDate = new Date();
      /*from w  ww. j a  va  2  s  . c o  m*/
      myDate.setHours(3);
      console.log(myDate.toString());
      

The code above generates the following result.





















Home »
  Javascript »
    Javascript Reference »




Array
Canvas Context
CSSStyleDeclaration
CSSStyleSheet
Date
Document
Event
Global
History
HTMLElement
Input Element
Location
Math
Number
String
Window