Mega Code Archive

 
Categories / JavaScript Tutorial / Date
 

Date setUTCHours()

Syntax date.setUTCHours(hours) The setUTCHours() 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.) universal time. 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>setUTCHours returned ");     document.write(theDate.setUTCHours(5)," milliseconds.")     document.write("<br>Final milliseconds=",theDate.getTime());     -->     </script>     </html>