Calendar Day based on calendar week

Hello everyone,

please tell me how to calculate a calendar date for a specific day of the week based on a calendar week?

For example, how do I calculate a date for monday in the 24th calendar week?

Best ragards
Alexander

Hi there, @a.m… I’m guessing there’s an easier way to do this (there almost has to be), and I’m sure someone will be along as soon as I post my response to point us in a better direction. That being said, I worked through it using the current date as the starting point, and it does seem to work like a charm. If you’re willing to bear with me on this one, here’s what I did…

date

  • The field with 24 in it is an input field where you enter a week number.
  • The field with Monday in it is a dropdown with the days of the week in it (it’s driven by an option set that includes the days of the week and an attribute that is the number associated with each day, starting with Monday as 1).
  • The field directly below the 24 is the current date’s week number minus the week number that is entered into the field above it (in this example, the current date’s week number is 25, which gives us 25-24=1).
  • The field with 7 in it is the field above it multiplied by 7 (which gives us the number of days between the current date and the same day in the week that is entered into the field with the 24 in it).
  • The field directly below the day of the week dropdown is the number of the day that is selected in the dropdown (in this example, Monday’s day number is 1).
  • The field below that one is the difference between the current date’s extracted day and the number in the field above it (in this example, the current day is Tuesday, which has a day number of 2, so it’s 2-1=1).
  • The field with -8 in it is the sum of the two fields to the left multiplied by -1 (which gives us the actual number of days we need to add to the current date to get the date we want).
  • Finally, the field that is showing 06/08/2020 is the current date plus the number of days in the field with -8 in it.

So, does any of that make sense? The bottom line is that I am getting the total number of days from/to the current date based on a week number and day of week input by the user, and the rest should be clear as mud.

I hope this helps in some way, shape, or form, even if it only shows you what you absolutely don’t want to do until someone comes along with a better response. :slight_smile:

Best…
Mike

4 Likes

Hi @mikeloc,

thank you very much, this is exactly what I needed!

Best
Alex

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.