Input DatetimeLocal step attribute

Definition and usage

step Attribute sets or returns the value of the step attribute of the local date and time field.

The HTML step attribute specifies the valid number intervals for 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, etc.

Tip: The step attribute is usually used with max and min Attributes used together to create a series of valid values.

See also:

HTML reference manual:Η ιδιότητα step του <input> του HTML

Example

Example 1

Change the valid number interval for seconds in the local date field:

document.getElementById("myLocalDate").step = "10";

Try it yourself

Example 2

Change the valid number interval in the local date field to milliseconds:

document.getElementById("myLocalDate").step = ".020";

Try it yourself

Example 3

Get the valid number interval for seconds in the local date field:

var x = document.getElementById("myLocalDate").step;

Try it yourself

Syntax

Return the step attribute:

datetimelocalObject.step

Set the step attribute:

datetimelocalObject.step = number

Attribute value

Value Description
number

Define the valid number intervals in the local date and time field.

For seconds:

Using numbers that will reach "60". For example: "1", "2", "10", "30" etc.

For milliseconds:

Starting from "." and using numbers that will reach "1000". For example: ".010", ".050", ".20" etc.

Technical details

Return value: Numbers, representing valid 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
Υποστήριξη 10.0 Υποστήριξη Υποστήριξη Υποστήριξη

Σημείωση:Το στοιχείο <input type="datetime-local"> δεν εμφανίζει κανένα πεδίο ημερομηνίας/χρονομετρητή στο Firefox.