the idea is this...
if a new month starts,
reset the counter to zero.
if a new day begins,
add one to the counter.
therefore:
on the first day of the new month,
the counter = zero.
it is a new day, so you add one to the counter,
the counter now becomes ONE.
if you keep on doing this...