Calculate Current Week No

Hey guys, I need some help. Im working in a project for a Swedish client, and in Sweden they use Week Numbers for many things. That is to say, instead of saying May the 7th, most Swedes would refer to as Thursday, week 19 for example

What I am trying to return is current week number.

Like this: Week Numbers 2021 in Sweden - Savvy Time

I have searched around and can’t find an API to return this information. So I’m looking at calculations, but date calcs are way above my head.

For my app I am thinking of a simple approach,

  • Input a field for Week 1 for Given Year: Current Year, Week 1, Day 1 Date.
  • Then find a way to calculate (Current start of the day) minus (Current Year, Week 1, Day 1 Date) to work out number of weeks in this range.

Does anyone have any experience in this or recommend a better way?

My main problem is that some years may have 53 weeks and some 52… Based on ISO8601 as week one will not always start January 1st.

Any help or suggestions would be great :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.