Open In App

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:



datetimelocalObject.step
datetimelocalObject.step = number

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

Return Value: It returns a numeric value, which represents 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: Note: The <input type=”datetime-local”> element does not show any datetime field/calendar in Firefox.

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


Article Tags :