Input Datetime type Attribute

Definition and Usage

type The attribute returns what type of form element the date field is.

Note:In the following example:

  • Safari and Opera 12 (and earlier versions) return "datetime"
  • Opera 15 (and later versions), Internet Explorer, Firefox, and Chrome return "text"

Example

What type of form element does the date-time field return:

var x = document.getElementById("myDatetime").type;

Try it yourself

Grammar

datetimeObject.type

Technical Details

Return Value: A string value that indicates the type of form element to which the date-time field belongs.

Browser Support

The numbers in the table indicate the first browser version that fully supports this property.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Support 10.0 Support Support Support

Note:The <input type="datetime"> element does not display any date-time field/calendar in any mainstream browser except Safari.