Date month and year only

I’m working on an app for which I want to store education data. Instead of having fields start_date and end_date with a date picker in the form, I would like the user to enter a start_month and start_year and end_month and end_year.

I wonder whether this feature is already available in Django or whether I should for example have fields start_date, start_month and start_year and end_date, end_month and end_year and after form submission compute the start_date and end_date

I hope someone can point me in the right direction

Kind regards,


You also have the option of using one of the available “datepicker” widgets that allow for month/year selection. (e.g. The bootstrap datepicker lets you limit entry to month / year.)

Beyond that, there is no data type within Django for just Month / Year.

Depending upon what all your requirements are for this date, you have a couple of different options:

  • Store it as a date field where the date is always ‘1’
  • Store it as two separate fields like you describe.
  • Store it in an integer field as “N” number of months from some starting date. (e.g. If your base date is 01/2001, then this month would be month 256 if I figured it correctly)

This last option makes it easiest to calculate durations but requires conversion for display.

Hi Ken,

Thanks for your helpful reply.

I’ll explore all three options and than decide which best suites my needs.

Kind regards,