The hours of the time value contained in the receiving object. This is returned as an integer in the range 0 to 23 inclusive.
The value is computed according to local time coordinates.
<HTML> <HEAD></HEAD> <BODY> <SCRIPT> // Generate a flag based on work or play time myDate = new Date(); myHours = myDate.getHours(); if((myHours > 8) && (myHours < 17)) { document.write("At work"); } else { document.write("At play"); } </SCRIPT> </BODY> </HTML>
See also: | Date.prototype, Date.setHours(), Date.setUTCHours() |
Prev | Home | Next |
Date.getFullYear() | Up | Date.getMilliseconds() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |