Dates and Time
Intended audience: users, HTML coders (using editors or scripting), script developers (PHP, JSP, etc.), schema developers (DTDs, XML Schema, RelaxNG, etc.), XSLT developers, Web project managers.
World-wide interaction in real-time (or near real-time) requires unambiguous representations of times and dates. Here are some
Dates and time in Web pages:
- Ambiguous dates cause confusion:
- 02/03/04: This may be March 4th, 2002 (in Japan,...), 2nd of March, 2004 (in Europe) and February 3rd, 2004
(in the USA). It depends on whom you ask, not whether they speak English or not.
- Use unambiguous dates on your web pages:
- Always use a four-digit number for the year (this clearly distinguishes the year from the day of the month)
- Always use words (abbreviated if necessary) for the months
- For forms, use structured dates and popup menus
- There were some proposals to add a <date> and/or <time> element to HTML, so that browsers could localize display, but
they never materialized.
- Date and time datatypes are available in XML Schema Part 2: Datatypes.
- The formats defined are for data interchange, not for display.
- To interchange a date as it appears in an actual document, define markup such as
value="2001-05-02">The second of May, 2001
- For time periods, use a start date and an end date. Other forms may not be translatable into different calendars.
And some handy little tools: