(Google translation)
Hello,
Since the beginning of the year 2019, I have a problem with the week numbers.
For example: Rainmeter shows me week 2 while we are in week 3 (as of 20/01/2019)
Previously everything went very well.
Do you have any idea to solve this problem?
Thank you and good day.
It is currently April 24th, 2024, 8:40 pm
Problem with week numbers
-
- Posts: 2
- Joined: January 20th, 2019, 8:51 am
-
- Posts: 571
- Joined: February 28th, 2011, 3:20 pm
- Location: Vienna, Austria
Re: Problem with week numbers
It depends what code you are using in your skin to retrieve the week number.
There are 3 codes (%U, %V and %W) for the week-number, according to the documentation of the time-measure
%U: Week of year number, with the first Sunday as first day of week one. (00 - 53)
%V: ISO 8601 week of year number (00 - 53)
%W: Week of year as number, with first Monday as first day of week one. (00 - 53)
I personally prefer %V as it is standardized.
Can you post at least the measure(s) that is/are responsible for the week-number?
There are 3 codes (%U, %V and %W) for the week-number, according to the documentation of the time-measure
%U: Week of year number, with the first Sunday as first day of week one. (00 - 53)
%V: ISO 8601 week of year number (00 - 53)
%W: Week of year as number, with first Monday as first day of week one. (00 - 53)
I personally prefer %V as it is standardized.
Can you post at least the measure(s) that is/are responsible for the week-number?
-
- Rainmeter Sage
- Posts: 2604
- Joined: March 23rd, 2015, 5:26 pm
Re: Problem with week numbers
The thing that is important to note is that Rainmeter returns week numbers that start with 0, with zero being the first week. To get the "proper" week number, you need to add 1 to the returned value.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Problem with week numbers
I'm not sure I agree with that.SilverAzide wrote: ↑January 20th, 2019, 5:03 pm The thing that is important to note is that Rainmeter returns week numbers that start with 0, with zero being the first week. To get the "proper" week number, you need to add 1 to the returned value.
https://www.epochconverter.com/weeknumbers
Code: Select all
[MeasureWeek]
Measure=Time
Format=%V
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with week numbers
Today being Sunday, this can cause some troubles. Setting the Format to %W or to %U give different results for today. On other days of week, the results are the same, but for Sunday they are not.
Today with Format set to %U, you get the third week, while with Format set to %W, the second week.
That's why would be important to find out what Format have used Heaven. I'm (we're?) waiting for his reply.
Today with Format set to %U, you get the third week, while with Format set to %W, the second week.
That's why would be important to find out what Format have used Heaven. I'm (we're?) waiting for his reply.
-
- Rainmeter Sage
- Posts: 2604
- Joined: March 23rd, 2015, 5:26 pm
Re: Problem with week numbers
OK, now I'm confused... so the first few days of this January was week zero??? That epochconverter website is NO help, it doesn't even agree with itself! See this: https://www.epochconverter.com/weeks/2019. It says week 1 of 2019 was December 31 to January 6.jsmorley wrote: ↑January 20th, 2019, 5:10 pm I'm not sure I agree with that.
https://www.epochconverter.com/weeknumbers
So which week is week 1?
-
- Rainmeter Sage
- Posts: 16168
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Problem with week numbers
Exactly. The first, not complete week of January is week 0 (this year it had 5 or 6 days, depending on which is considered the first day of week). Week 1 is the first complete week.SilverAzide wrote: ↑January 20th, 2019, 8:32 pm OK, now I'm confused... so the first few days of this January was week zero???
-
- Rainmeter Sage
- Posts: 2604
- Joined: March 23rd, 2015, 5:26 pm
Re: Problem with week numbers
jsmorley wrote: ↑January 20th, 2019, 5:10 pm I'm not sure I agree with that.
https://www.epochconverter.com/weeknumbers
Actually, I'm going to go out on a limb and say, sorry, both of you are partly incorrect on this one. There is definite a problem in the Rainmeter documentation first off, and I'm seriously thinking that the "U/W" format masks are returning wrong values.
The first error is in the docs. The docs claim format %V has a range of 00-53. That's 54 possible weeks, which is flat out NOT gonna happen regardless of leap days, leap years, etc. Per the ISO standard, the correct range for %V should be 01-53. There is no such thing as week zero in ISO. The page here https://www.epochconverter.com/weeks/2019 is correct, and also matches Wikipedia's entry here https://en.wikipedia.org/wiki/ISO_week_date. Rainmeter's Time measure with %V is returning the correct values.
(Jsmorley, your calendar screenshot is right, but remember ISO weeks start on Monday, so your blue circles are the LAST day of that week, not the first.)
The second issue I have is with %U and %W. I assume that these formats are most useful for enumerating weeks as shown on a calendar, otherwise I'm not sure what else they could be used for. I don't think returning zero is correct, but at this point changing the return values to be one-based would probably break a million calendar skins. The range of 00-53 would seem to be correct as shown in the Rainmeter docs, since you'd need 54 "rows" of values to draw a full calendar for any possible year (including leading and trailing days from adjacent years). People just need to be aware that if you ask them what week it is, "zero" is not the right answer.
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Problem with week numbers
You're right, there was an ancient error in the docs for the %V time code. I have fixed it.
What we use is a simple call to the strftime function in C++, which is documented here:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2017
What we use is a simple call to the strftime function in C++, which is documented here:
https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/strftime-wcsftime-strftime-l-wcsftime-l?view=vs-2017
-
- Posts: 2
- Joined: January 20th, 2019, 8:51 am
Re: Problem with week numbers
Google translation
Am very bad in English
Thank you all for your participation.
I put %V and it works.
Am very bad in English
Thank you all for your participation.
I put %V and it works.