THE WORLD'S LARGEST WEB DEVELOPER SITE

Input DatetimeLocal step Property

❮ Input DatetimeLocal Object

Example

Change the legal number intervals for seconds in a local date field:

document.getElementById("myLocalDate").step = "10";
Try it Yourself »

Definition and Usage

The step property sets or returns the value of the step attribute of a local datetime field.

The step attribute specifies the legal number intervals for seconds or milliseconds in a local datetime field (does not apply for days, months, years, hours or minutes).

Example: if step="2", legal numbers could be 0, 2, 4, etc.

Tip: The step attribute is often used together with the max and min attributes to create a range of legal values.


Browser Support

Property
step Yes 10.0 Yes Yes Yes

Note: The <input type="datetime-local"> element does not show any datetime field/calendar in Firefox.


Syntax

Return the step property:

datetimelocalObject.step

Set the step property:

datetimelocalObject.step = number

Property Values

Value Description
number Specifies the legal number intervals in the local datetime field.

For seconds:

  • Use numbers that will eventually reach "60". Like: "1, "2", "10", "30", etc.

For milliseconds:

  • Start with "." and use numbers that eventually will reach "1000". Like ".010", ".050", ".20", etc.


Technical Details

Return Value: A Number, representing the legal number intervals for seconds or milliseconds

More Examples

Example

Change the legal number intervals for milliseconds in a local date field:

document.getElementById("myLocalDate").step = ".020";
Try it Yourself »

Example

Get the legal number intervals for seconds in a local date field:

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

The result of x will be:

5
Try it Yourself »

Related Pages

HTML reference: HTML <input> step Attribute


❮ Input DatetimeLocal Object