Zend certified PHP/Magento developer

How to set custom invoice number

What I would like to achieve is to have the invoice number defined as so:

YYYYMMDDD

Where YYYY represents the current year, MM the current month and DDD the number that increments for each invoice.

The issue is that I don’t know how to automatically reset the three digits at the beginning of each month.

Example:

1st invoice of March: 202003001

2nd invoice of March: 202003002

3rd invoice of March: 202003003

1st invoice of April: 202004001