Saltar al contenido principal
← 📄 HTML & the platform·Módulo A3 · Lección 4
TareaBuild an event form: <input name='date' type='date' min='2026-01-01'> and <input name='time' type='time'>.

Entradas de fecha/hora

75 XP7 min
Teoría

Native pickers — no jQuery datepicker needed

<input type="date" name="dob" />                  <!-- 2026-05-20 -->
<input type="time" name="alarm" />                <!-- 14:30 -->
<input type="datetime-local" name="meeting" />    <!-- 2026-05-20T14:30 -->
<input type="month" name="month" />               <!-- 2026-05 -->
<input type="week" name="week" />                 <!-- 2026-W21 -->

Every modern browser ships a calendar/clock picker. The user types or picks; the value submitted is ISO 8601.

ISO 8601 is the only format

Don't put format hints in placeholders like "MM/DD/YYYY". The browser localizes display to the user's locale automatically — they see "May 20, 2026" in en-US, "20 Mai 2026" in de-DE, "20/05/2026" in en-GB. The value that gets posted is always YYYY-MM-DD.

min and max work

<input type="date" name="dob" max="2026-05-20" />   <!-- can't pick a future date -->
<input type="date" name="appt" min="2026-06-01" max="2026-12-31" />

datetime-local has no timezone

The submitted value is 2026-05-20T14:30 with no Z or offset. The browser sends it in the user's local time, and your backend must store the user's timezone separately (or assume UTC). Use type="datetime-local" for "wall clock" times (meetings, alarms) and a server-side picker for absolute UTC instants.

🔒

Regístrate para empezar a programar

La teoría está abierta a todos. El editor, la vista previa y el check se desbloquean con una prueba gratis de 7 días — se requiere tarjeta, cancela cuando quieras.

Registrarse — prueba gratis →

Las primeras 10 lecciones de cada ruta son gratis. No se necesita tarjeta.

← AnteriorSiguiente lección →

Recibe un consejo de Python o web al día — por email

Corto, escrito a mano, sin spam. Anula la suscripción en un clic.