Input Datetime max Attribute

Definition and Usage

max Attribute sets or returns the value of the max attribute of the date-time field.

HTML max attribute specifies the maximum value (date and time) for the date-time field.

Tip:Use the max attribute and min attribute to create a valid value range.

Tip:To set or return the value of the min attribute, use min attribute

See also:

HTML Reference Manual:Atribut max <input> HTML

Instance

Example 1

Get the furthest date and time allowed for the date-time field:

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

Try It Yourself

Example 2

Change the furthest date and time:

document.getElementById("myDatetime").max = "2012-01-01T11:57Z";

Try It Yourself

Syntax

Return max attribute:

datetimeObject.max

Set max attribute:

datetimeObject.max = YYYY-MM-DDThh:mm:ssTZD

Attribute Value

Value Description
YYYY-MM-DDThh:mm:ssTZD

The furthest date and/or time allowed for the specified date-time field.

Component Description:

  • YYYY - Year (e.g., 2023)
  • MM - Month (e.g., 02 represents February)
  • DD - Day of the month (e.g., 15)
  • T - If time is specified, then the separator is required
  • hh - Hours (e.g., 22 represents 10 PM)
  • mm - Minutes (e.g., 55)
  • ss - Seconds (e.g., 06)
  • TZD - Time Zone Indicator (Z represents Zulu, also known as Greenwich Mean Time)

Technical Details

Return Value: Nilai string, yang menandai tanggal dan waktu paling jauh yang diijinkan.

Dukungan Peramban

Angka di tabel menandai versi peramban pertama yang mendukung atribut ini penuh.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Dukungan 10.0 Dukungan Dukungan Dukungan

Perhatian:Elemen <input type="datetime"> tidak menampilkan bidang tanggal dan waktu kalender di seluruh peramban utama kecuali Safari.