0

I have a spreadsheet where I track my expenses. Each month has it's own tab (e.g., Jan, Feb, Mar...).

Within the month tab, I break the month down into four weeks and track my spending weekly.

I have written a script to create a new month tab, but I'm not sure how to set those weekly date ranges since months have different numbers of days (i.e., 28, 30, 31).

ranges

How would I go about setting the following items regardless of the month: - first day of first week of month - last day of first week of month - first day of second week of month - last day of second week of month - first day of third week of month - last day of third week of month - first day of fourth week of month

Kyle W
  • 15
  • 3
  • Are you familiar with all of the methods described here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date – Cooper May 22 '20 at 17:21
  • I am not, thanks for sharing. After reading the post you linked, I'm still not clear how I apportion the weeks correctly if the month has 28 days versus 31. Any suggestions? – Kyle W May 22 '20 at 18:56
  • `function daysInMonth(m=0) { return new Date(new Date().getFullYear(),m+1,0).getDate(); }` – Cooper May 22 '20 at 19:13

0 Answers0