When writing a date, a comma is used to separate the day from the month, and the date from the year.
But if you’re writing the date in day-month-year format, you don’t need a comma.
Do use a comma if you’re including a day of the week with the date. Note the use of the comma after the date when it appears in the middle of a sentence.
When you’re giving only a month and a year, you don’t need a comma.