splitforms.com

HTML · INPUT TYPE

HTML input type=datetime-local

An <input type="datetime-local"> shows a date and time picker. It submits the user's local wall-clock time in the format yyyy-mm-ddTHH:mm, such as 2026-11-03T14:30. The date and time are joined with a literal T, and the value carries no time zone or offset. Seconds appear only when step is less than 60.

  • Live, editable example
  • Copy-paste snippet
  • Attributes & common mistakes
Live demo · nothing is sent

What gets submitted

Fill in the form above and press its button. The demo stops the request and lists every name=value pair the browser would send, plus the controls it leaves out.

With a free access key in the form, these fields land in your splitforms dashboard; access_key and botcheck are read by splitforms, not stored as lead data.

Edit the HTML and re-run it
Runs in a sandbox. Nothing is sent.

Minimal snippet

datetime-local-example.html
<input type="datetime-local" id="callback" name="callback_at"
       min="2026-11-03T09:00" max="2026-11-03T17:00" step="1800">

Want this form to email you its submissions? Point it at a free splitforms endpoint, with no server to build. Get a free access key →

Copy-paste code

HTML input type=datetime-local code you can paste today.

Replace YOUR_ACCESS_KEY with a key from your free splitforms dashboard. The form posts to one endpoint — submissions land in your inbox and dashboard with spam filtering built in.

input-type-datetime-local.html
<form action="https://splitforms.com/api/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">

  <label for="name">Name</label>
  <input type="text" id="name" name="name" autocomplete="name" required>

  <label for="callback_at">Callback date and time</label>
  <input type="datetime-local" id="callback_at" name="callback_at"
         min="2026-11-03T09:00" max="2026-11-03T17:00" step="1800" required>

  <!-- Send the visitor's time zone so the server can build a real instant -->
  <input type="hidden" id="timezone" name="timezone">
  <script>document.getElementById("timezone").value = Intl.DateTimeFormat().resolvedOptions().timeZone;</script>

  <!-- Honeypot: hidden from people, bots fill it in -->
  <input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Request callback</button>
</form>

Attributes · <input type="datetime-local">

Which HTML input type=datetime-local attributes matter?

These attributes decide how the <input type="datetime-local"> behaves and what actually gets emailed to your inbox when someone submits.

HTML input type=datetime-local attributes and what each one does
AttributeWhat it doesDocs
nameThe key the value is sent under, such as callback_at. Without a name, the value is never sent.
minThe earliest allowed value, in the same yyyy-mm-ddTHH:mm format (such as 2026-11-03T09:00).MDN
maxThe latest allowed value, in the same yyyy-mm-ddTHH:mm format (such as 2026-11-03T17:00).MDN
stepThe step interval in seconds. The default is 60 (one minute). Use 1800 for 30-minute slots, or 1 for seconds.MDN
valueThe default value in yyyy-mm-ddTHH:mm format (such as 2026-11-03T14:30).MDN
requiredRequires a value to be chosen before the form can be submitted.MDN

Common mistakes

HTML input type=datetime-local not working? Here's why.

Most broken forms come down to a few small mistakes with the <input type="datetime-local">. Check these before you ship, then forward every submission to Slack or a webhook.

  1. The value has no time zone

    The submitted value is the user's local wall-clock time with no offset and no Z. The server cannot treat it as UTC. Send the time zone in a hidden field filled by JS, or convert to UTC on the client before submitting.

  2. The T separator and the seconds rule

    The date and time are joined with a literal T, and seconds appear only when step is less than 60. With the default step of 60 the value is always yyyy-mm-ddTHH:mm, never HH:mm:ss.

  3. type=datetime is obsolete

    The old type=datetime is obsolete and browsers render it as a plain text input. Use type=datetime-local for a real date and time picker.

  4. The time part looks different between browsers

    Firefox desktop supports datetime-local, but the time part of the picker looks different in each browser and follows the user's locale. The submitted value is the same fixed format everywhere.

Sources: WHATWG HTML Standard: <input type="datetime-local"> · MDN: <input type="datetime-local">

Key benefits

Copy-paste ready

The HTML input type=datetime-local example below is a complete, working form — paste it into any HTML page and it submits, no edits to the markup required.

No backend to build

Your html input type=datetime-local form posts to one endpoint. No server, PHP, or API route — accepted submissions are saved to your dashboard before owner notification email is attempted; delivery time and inbox placement depend on provider and recipient settings.

A form that really submits

Unlike a static reference snippet, this <input type="datetime-local"> form actually sends data to a free splitforms backend, with spam filtering built in.

How it works

How to add HTML input type=datetime-local to any page.

Copy the html input type=datetime-local example, drop in your free access key, and paste it into any page — submissions start landing in your dashboard.

  1. Copy the code

    Copy the HTML input type=datetime-local example below.

  2. Add your access key

    Replace YOUR_ACCESS_KEY with a free splitforms key from the dashboard.

  3. Paste into your site

    Drop the form into any HTML page. Submissions arrive in your dashboard.

Questions

HTML input type=datetime-local questions, answered.

Anything missing? Email us, we read every message.

A person reading answers to common questions
What does the backend receive from a datetime-local field?

A string like 2026-11-03T14:30, URL-encoded in the request body, so the colon arrives as %3A (2026-11-03T14%3A30) and the T stays as it is. The value has no time zone or offset, so the server cannot treat it as UTC.

How do I set the default value to now?

Build the value from the local date and time, not from toISOString(), which is UTC and can be a day off. Format the local year, month, day, hour and minute into yyyy-mm-ddTHH:mm and set it on the input's value in JavaScript.

Why does the value have no Z?

Because datetime-local captures the user's local wall-clock time, not a UTC instant. There is no offset to encode, so the value ends at the minute. If you need a real instant, send the time zone separately and combine them on the server.

How do I book appointments in 30-minute slots?

Set step="1800" on the input, because the step is in seconds and 1800 is 30 minutes. Set min to the start of the first slot so the steps line up, and check the value again on the server.

How do I convert the value to UTC on the server?

You cannot convert it without the time zone, because the value alone is only a wall-clock time. Send the zone in a hidden field filled with Intl.DateTimeFormat().resolvedOptions().timeZone, then on the server parse the value with that zone (for example with an IANA time zone database) to get the UTC instant.

View all FAQs

Make this form actually submit.

Point your form at splitforms. 500 free submissions a month, spam filtering, webhooks on paid plans — no server.

  • No credit card required
  • 500 free submissions
  • Setup in minutes
Two people celebrating a working contact form