{"id":5892,"date":"2014-01-28T01:19:00","date_gmt":"2014-01-28T01:19:00","guid":{"rendered":"https:\/\/www.htmlgoodies.com\/uncategorized\/exploring-html5s-new-datetime-input-types-for-your-web-apps\/"},"modified":"2021-08-06T18:08:02","modified_gmt":"2021-08-06T18:08:02","slug":"exploring-html5s-new-datetime-input-types-for-your-web-apps","status":"publish","type":"post","link":"https:\/\/www.htmlgoodies.com\/mobile\/exploring-html5s-new-datetime-input-types-for-your-web-apps\/","title":{"rendered":"Exploring HTML5’s New ‘datetime’ Input Types For Your Web Apps"},"content":{"rendered":"

HTML5 introduces a lot of changes to support the new scenarios in which the “Web” is being used. One of the new changes being introduced in HTML5 is the support for date\/time as a first class input element type. The introduction of this new input type allows web developers to get the input element’s value as a string which represents date\/time.<\/p>\n

There are two input types supported for “datetime” like inputs.<\/p>\n

1.       The “datetime” input type – is a global date-and-time input control. An input  control with “datetime” input type represents a control whose element’s value represents a global date and time (with timezone information)<\/p>\n

2.       The “datetime-local” input type is a local date-and-time input control. An input control with “datetime-local” input type represents a control whose element’s value represents a local date and time (and does not contain timezone information).<\/p>\n

 <\/p>\n

Both the input types are very similar, the chief difference being that with “datetime” input type, the user agents may display the date and time in a user-appropriate timezone. Both the input types require valid datetime values as part of the value attribute.  Moreover, the “datetime-local” input requires that the date time value should be a valid local datetime value.<\/p>\n

The following attributes apply to an input element with “datetime” or “datetime-local” input type.<\/p>\n