HTML and CSS Reference
In-Depth Information
date
The date type is used for specific days in history, such as January 23, 1987, or September 18, 2012. The
attributes min and max can be applied to limit the range of values the user can choose. For example, this input
field asks the user for a date in 2008:
<input type="date" name="date"
min="2008-01-01" max="2008-12-31"/>
The form for date data entry is the ISO standard form YYYY-MM-DD (e.g., 2008-06-23). If you expect dates in a
different form, such as MM/DD/YYYY, you'll need to change the form processor on the server to accept the new
format before deploying this on the client.
When you tag an input field as type date , the browser can offer a calendar control so that the user can pick a
date.
time
The time type is used for times of day, such as 12:31 a.m. or 3:17:05 p.m. The default precision is 60 seconds
(i.e., one minute), though you can adjust this with the step attribute. You can also specify minimum and
maximum times with the min and max attributes. For example, this field requests a time between 9:00 a.m. and
5:00 p.m. on the hour or half hour:
<label>Start time:
<input type="time" min="09:00" max="17:00"
step="30" name="st" />
</label>
The form for time data entry is the ISO 8601 standard form HH:MM:SS.xxx (e.g., 03:45:13.23 for 3:45 a.m.
and 13.23 seconds). Seconds are optional. Times after noon use a 24-hour clock—for example, 14:37, not 2:37
p.m. Time zones are not used.
When you tag an input field as type time , the browser can offer a more specific time control, as well as check
that the user indeed entered a valid time.
datetime
The datetime type is used when you want the user to enter a specific moment in history—for example, not just
3:45 p.m. or December 12, 1982, but 3:45 p.m. on December 12, 1982. Data will be submitted in the form
Search WWH ::




Custom Search