Dofactory.com
Dofactory.com
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> type="datetime-local"

The <input> tag with a type="datetime-local" attribute creates an input field that accepts a date and time value which does not include the timezone (hence ‘local‘).

Clicking the calendar icon opens a datetime picker.

Example

#

An <input> element of type datetime-local.
Clicking the calendar icon opens a datetime picker. Alternatively, enter a datetime directly into the field.

Registration date

<form action="/tutorial/action.html">
  <fieldset>
    <legend>Registration date</legend>

    <input type="datetime-local" name="registrationdate"><br /><br />

    <input type="submit" value="Submit">
  </fieldset>
</form>

Using input type="datetime-local"

The <input type="datetime-local"> tag creates an input field for date and time.

The -local suffix does not mean the time is local to the user, instead it is a time without a timezone.

The UI of this control varies from browser to browser. Browser support is limited.

A similarly named <input type="datetime"> is obsolete.


Syntax

<input type="datetime-local">

Browser support

Here is when type="datetime-local" support started for each browser:

Chrome
25.0 Jan 2015
Firefox
Not Supported
IE/Edge
38.0 Nov 2015
Opera
10.0 Aug 2009
Safari
Partial Support

You may also like

 Back to <input>

Last updated on Sep 30, 2023

Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides