HTML5 Month Input Type

The month type is used to specify the particular month and year by the user. The month type is used in <input> tag. It only specifies the month and year and not the date. To specify the complete date we can use date input type. One example is the credit card expiry date where only month and year is displayed.

Syntax month Input Type

<input type= “month”>

Browser Support

month type is supported by Chrome, Safari and Opera.

HTML5 date Input Type Example

<!DOCTYPE html>
<title>Month Input Type</title>
		Your card expires on:<input type="month">

  • In this program we have shown how to take month and year in the form.
  • In this program we are setting month and year using the month type in input tag.

Example Application Test

  • Save the file as month_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 Month Input Type

Something like this:




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.

  • http://nil Gunaseelan

    How to make a html for card payment ? Especially for selecting the card expiration month and year?