HTML | DOM Input DatetimeLocal step Property

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.

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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>                                                

chevron_right


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


My Personal Notes arrow_drop_up

I am a technology enthusiast who has a keen interest in programming I am pursuing Engineering in Computer Science from GEU, Dehradun I like to unwind by watching movies and English sitcomsI have a keen interest in music

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.