如何使HTML时间输入仅显示小时

时间:2019-12-03 18:54:55

标签: html

如何强制HTML时间输入仅呈现小时数?我不需要输入分钟和秒钟。

<label for="appt">Choose a time for your meeting:</label>

<input type="time" id="appt" name="appt"
       min="07:00" max="18:00" value="07:00" required>

<small>Office hours are 9am to 6pm</small>

1 个答案:

答案 0 :(得分:2)

您可以使用step = 3600

<label for="appt">Choose a time for your meeting:</label>

<input type="time" id="appt" name="appt"
       min="07:00" max="18:00" value="07:00" step=3600 required>

<small>Office hours are 9am to 6pm</small>

更多详细信息here