Skip to Content
🎲 Welcome to RandBox - Powerful JavaScript Random Data Generation Library! Learn More

hour

// usage randBox.hour() randBox.hour({twentyfour: true})

Generate a random hour

randBox.hour(); => 9

By default, returns an hour from 1 to 12 for a standard 12-hour clock .

Can optionally specify a full twenty-four.

randBox.hour({twentyfour: true}); => 21

This will return an hour from 1 to 24.