I struggled a bit with this, so I figured I’d leave this here.

Dividing the day of the month by 7 and rounding up would work… if the week started on a Sunday (or whatever day you choose to start the week with).

To account for the shift in days, shift ‘back’ by subtracting the day of week from the day.

Maria Ma

A public health nerd. I make graphs in R.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store