htmldatetimeattributesinput-type-range

html date format yyyy mm dd hh24 mi ss AS INPUT TYPE IN HTML



TODAY I tried IN HTML TAG INPUT with DATETIME attribute but It's not warking AS shown below

Start Time: <br><input type="datetime" name="TOI" ><br>

But There is only A input Type Box Not calender AS I papoose there.. I have to submite a value="2015-04-01 12:52:19".. Need both Time and date but in input type it's not working... Can anyone tell me why it's not working..


Solution

  • <input> elements with type="datetime" are not supported in Chrome, Internet Explorer, Firefox or Opera 15 and newer. Partial support in Safari. Full support in Opera 12 and earlier versions.

    Access an Input Datetime Object You can access an <input> element with type="datetime" by using getElementById():

    var x = document.getElementById("myDatetime"); Try it Tip: You can also access <input type="datetime"> by searching through the elements collection of a form.

    Create an Input Datetime Object You can create an <input> element with type="datetime" by using the document.createElement() method:

    var x = document.createElement("INPUT");
    x.setAttribute("type", "datetime");
    

    OR you can use <input type="datetime-local" name="date">

    You can also use many built libraries available like bootstrap.