Skip to Content
🎲 欢迎使用 RandBox - 功能强大的 JavaScript 随机数据生成库! 了解详情

hour

// 用法 randBox.hour() randBox.hour({twentyfour: true})

生成一个随机小时

randBox.hour(); => 9

默认情况下,返回标准 12 小时制  的 1 到 12 之间的小时。

可选择指定完整的 24 小时。

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

这将返回 1 到 24 之间的小时。

最后更新于: