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.
Notice how in our examples above, the dates are expressed as cardinals, not ordinals—as in, there’s no th, rd, or nd after the numeral: April 15, 2017, instead of April 15th, 2017. In formal writing, always express cardinal numbers in dates, even though when we might say a date out loud we express it as an ordinal: “January third.”
If you use a construction with of, it is OK to use an ordinal number. It is also acceptable to use an ordinal number when referring to a specific day without referring to the month.
When you’re expressing a date in this way, with the ordinal before the month, you don’t need a comma.