Input DatetimeLocal step attribute
Definition and Usage
step
Sets or returns the value of the step attribute of the local date and time field.
The HTML step attribute specifies the valid time intervals in seconds or milliseconds in the local date and time field (not applicable to days, months, years, hours, or minutes).
For example, if step="2", valid numbers can be 0, 2, 4, and so on.
Tip: The step attribute is usually used with max and min Used together with attributes to create a series of valid values.
See also:
HTML Reference Manual:HTML <input> step Attribute
Example
Example 1
Change the valid time interval in seconds in the local date field:
document.getElementById("myLocalDate").step = "10";
Example 2
Change the valid time interval in milliseconds in the local date field:
document.getElementById("myLocalDate").step = ".020";
Example 3
Get the valid time interval in seconds in the local date field:
var x = document.getElementById("myLocalDate").step;
Syntax
Return the step attribute:
datetimelocalObject.step
Set the step attribute:
datetimelocalObject.step = number
Attribute value
Value | Description |
---|---|
number |
Define the valid time intervals in the local date and time field. For seconds:Using numbers that will eventually reach "60". For example: "1", "2", "10", "30" and so on. For milliseconds:Starting from "." and using numbers that will eventually reach "1000". For example: ".010", ".050", ".20" and so on. |
Technical details
Return value: | Numbers, representing valid time intervals in seconds or milliseconds. |
---|
Browser support
The numbers in the table indicate the first browser version that fully supports this attribute.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | Support | Support | Support |
Note:The <input type="datetime-local"> element does not display any date and time fields/calendars in Firefox.