Skip to content
Related Articles

Related Articles

HTML | DOM Input DatetimeLocal step Property
  • Difficulty Level : Basic
  • Last Updated : 07 Mar, 2019

The Input DatetimeLocal Step property in HTML DOM is used to set or return the value of the step attribute of a local datetime field. The Input Step attribute can be used for specifying the legal number intervals for seconds or milliseconds in a local datetime field. The step property cannot be used to affect the days, months, years, hours or minutes.

Syntax:

  • It returns the Input DatetimeLocal Step property.
    datetimelocalObject.step
  • It is used to set Input DatetimeLocal Step property.
    datetimelocalObject.step = number

Property Values: It contains single property value number which is used to specify the legal number intervals for seconds or milliseconds.

Below program illustrates the DatetimeLocal step property in HTML DOM:

Example: This example changes the legal number intervals for seconds in a local date field.






<!DOCTYPE html>
<html>
      
<head
    <title>
        HTML DOM Input DatetimeLocal step Property
    </title
</head>
  
<body style="text-align:center;">
  
    <h1 style="color:green;">
        GeeksforGeeks
    </h1
      
    <h2 style="font-family: Impact;">
        Input DatetimeLocal step Property
    </h2>
      
    <input type="datetime-local" id="Test_Datetime">
      
    <p>
        To update the step, double click
        the "Change Step" button.
    </p>
      
    <button ondblclick="My_DatetimeLocal()">
        Change Step
    </button>
      
    <p id="test"></p>
      
    <script>
        function My_DatetimeLocal() {
            document.getElementById("Test_Datetime").step
                    = "5";
                      
            document.getElementById("test").innerHTML
                    = "The step attribute has been "
                      + "changed to '5'.";
        }
    </script>
</body>
  
</html>                                                


Output:
Before clicking the button:

After clicking the button:

Supported Browsers: The browser supported by Input DatetimeLocal step property are listed below:

  • Apple Safari
  • Internet Explorer 10.0
  • Firefox
  • Google Chrome
  • Opera

full-stack-img

My Personal Notes arrow_drop_up
Recommended Articles
Page :