11-19-2013 07:21 PM
I have some difficulties understanding this week number generated by LabVIEW. "%U" format code will generate "1/1/2012"'s week number as "01", which is the second week of the year ("00" is the first week of the year). Where is the first week on 2012? The following is from LabVIEW help:
"week number of the year (00–53), with the first Sunday as the first day of week one; 00 represents the first week"
11-19-2013 10:17 PM
"week number of the year (00–53), with the first Sunday as the first day of week one; 00 represents the first week"
Jan 1, 2012 is a Sunday. It is the first Sunday of 2012 and is thus week 1. There are no days in 2012 before that 1st Sunday, so there are no days that are in Week 0.
Week 0 is the incomplete week with all the days that fall before the 1st Sunday of the new year.
If you did Jan 1, 2013, you'd see it is in week 0, because it is a Tuesday. Tuesday the 1st through Saturday the 5th all make up week 0.
Sunday January 6, 2013 is the first Sunday of 2013, so that is the start of week 1.
11-20-2013 12:20 AM
RavensFan,
Thanks for the reply. If the "week one" in the LabVIEW help means week "01" then it's understandable. "week one" and "first week" sounds like the same thing, is it that "week one" is week "01" and "first week" is week "00"?
11-20-2013 01:09 AM
Hello guangdew1,
Yes, "One" always means "1", whereas what comes "first" (foremost, earliest) depends on what numbering system you're using- because in this case the week is zero-indexed, "0" is first. This is similar to how the zero index in an array would be considered the first element.
Regards,
11-20-2013 01:37 AM
Hi Tom,
Thanks for your reply, I think I can understand it even though it still sounds strange. In 2012, the year started with second week, there's no first week, is it correct?
11-20-2013 10:30 AM
Correct. "Week 0" is used when there is a partial week (1-6 days before Sunday) at the beginning of the year, which is most years.
Regards,
11-20-2013 03:20 PM
11-20-2013 04:04 PM
GerdW,
Thanks for replying my post. I don't have an application to use the week number yet, still it's good to make it clear.
11-21-2013 11:43 AM
@GerdW wrote:
Hi guangdew,
maybe you want to use ISO week numbering instead, it always starts with week 01... 😄
I have worked for maybe a half dozen US companies and one with European roots. Different companies handle the transition to a new year differently. I've seen the new year start on the first day of the work week that will contain January 1. I've seen the new year start on the first day of the work week after January 1. I've seen W52 or W53 end at midnight on December 31 and W01 of the next year start on January 1, with both being partial weeks.
Then there's the inconsistency of when a week starts. Midnight Monday morning? Midnight Saturday morning?
Standardization is always a good thing! 😄
Jeff
11-21-2013 12:04 PM
@GerdW wrote:
Hi guangdew,
maybe you want to use ISO week numbering instead, it always starts with week 01... 😄
There is a NI Community Example for determining the ISO-8601 Week number:
https://decibel.ni.com/content/docs/DOC-30565