Hour: Difference between revisions
Jump to navigation
Jump to search
Add javascript snippet |
|||
Line 5: | Line 5: | ||
Hour returns a whole number ranging from 0 to 23 that represents the hour of day of a given time. The required parameter, ''time'', can be any numeric or string expression, or any expression that represents a time. | Hour returns a whole number ranging from 0 to 23 that represents the hour of day of a given time. The required parameter, ''time'', can be any numeric or string expression, or any expression that represents a time. | ||
== Example == | == Example (Basic) == | ||
<pre> | <pre> | ||
Rem Hour Example | Rem Hour Example | ||
'Hour returns hour of day from a time | 'Hour returns hour of day from a time | ||
Print "Hour of " & FormatDateTime(Now,4) & | Print "Hour of " & FormatDateTime(Now,4) & " is " & Hour(Now) | ||
</pre> | |||
== Example (JavaScript) == | |||
<pre> | |||
// Hour Example | |||
/* Hour returns hour of day from a time */ | |||
var dt = new Date(); | |||
document.write("Hour of " + dt.toString() + " is " + dt.getHours()); | |||
</pre> | </pre> | ||
Revision as of 20:27, 19 May 2013
Hour(time)
Description
Hour returns a whole number ranging from 0 to 23 that represents the hour of day of a given time. The required parameter, time, can be any numeric or string expression, or any expression that represents a time.
Example (Basic)
Rem Hour Example 'Hour returns hour of day from a time Print "Hour of " & FormatDateTime(Now,4) & " is " & Hour(Now)
Example (JavaScript)
// Hour Example /* Hour returns hour of day from a time */ var dt = new Date(); document.write("Hour of " + dt.toString() + " is " + dt.getHours());
Output
The Hour of 8/18/1998 10:52:44 PM is 22 (sample date output is system dependant)