Date.setHours() : setHours « Date « JavaScript Tutorial






Syntax

date.setHours(hours)

The setHours() method sets the hour in the Date object to the argument hours, an integer from 0 (12:00 a.m. midnight) to 23 (11:00 p.m.).

The method returns an integer representing the number of milliseconds between midnight January 1, 1970 (GMT) to the new date.

<html>
    <script language="JavaScript">
    <!--
    theDate = new Date();

    document.write("Initial milliseconds=",theDate.getTime());
    document.write("<br>setHours returned ");
    document.write(theDate.setHours(7)," milliseconds.")
    document.write("<br>Final milliseconds=",theDate.getTime());

    -->
    </script>
    </html>








12.28.setHours
12.28.1.Date.setHours()