Interested in improving this site? Please check the To Do page.

Back to Date Verbs

date.hour

Extracts the hour (0-23) from the date.

Syntax

date.hour (date)

Params

date is optional. It can be a valid Frontier date, or anything that can be coerced to a date (like a string or a number). If omitted, then the current date is used as would be returned by clock.now()

Returns

A number, the hour portion of the date (0-23)

Examples

date.hour ()
	 » 9

date.hour ("9/9/1972; 6:53 PM")
	 » 18

date.hour (934878454)
	 » 8

date.hour (clock.now ())
	 » 9

Notes

If the date parameter is not actually a date, and can not be coerced to a date, you will often get a bogus result. For example, on the Macintosh:

date.hour( "this is not a date" )
	 » 0

That should have generated an error, but didn’t. However, this bug is inherited from the date() verb, which returns bogus values from bogus input.

Reference

See Also


Personal Tools