JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy

HTML5 Datetime-local Input Type

March 21, 2014 by Krishna Srinivasan Leave a Comment

The datetime-local type is used to specify the both date and time. It displays the complete particular date (year, month and date) and time(hour and minute). It is in 12 hour format, so the user also have to set AM or PM while setting the time. The datetime-local type is used in <input> tag.

Syntax of Datetime-local Input Type

[code lang=”html”]
<input type= "datetime-local">
[/code]

Browser Support

The datetime-local input type is supported by Google Chrome, Safari and Opera.

HTML5 datetime-local Input Type Example

[code lang=”html”]
<!DOCTYPE html>
<head>
<title>DateTime-locale</title>
</head>
<body>
<form>
Appointment to the Doctor :<input type="datetime-local" >
</form>

</body>
</html>
[/code]

  • Here in this program we have to set both date and time with AM & PM by using datetime-local type in input tag.
  • <input type=”datetime-local” > is used for datetime-local type.

HTML5 Datetime-local Demo

  • Save the file as datetime-local_example.html in your system.
  • Just open the file in the browser, you will see the below picture in the browser.
    Note that the browser must support HTML5 specification.

When the execution process is completed successfully we will get the following output:

HTML5 Datetime-local Input Type
Here we can set the complete date and time of 12 hour format.

Filed Under: HTML Tagged With: HTML5

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved