O'Reilly logo

HTML5 Multimedia Development Cookbook by Lee Jordan, Dale Cruse

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a picker to display date and time

Every plane, train, and automobile rental website is going to have some sort of time/date picker. It's great to finally have a semantic method to approach this so let's look at how to create these input types using HTML5.

Tip

As of this writing, only the Opera browser offers full support for each of these new input tags.

How to do it...

HTML5 actually has six different new inputs that can control date and time. Briefly, they are:

  • <input type="date" />
  • <input type="datetime" />
  • <input type="datetime-local" />
  • <input type="month" />
  • <input type="time" />
  • <input type="week" />

Each of these input types can be thought of as variations of one another. It's our job as developers to choose to the one that best fits the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required