LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Week number

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"

0 Kudos
Message 1 of 12
(7,181 Views)

 

"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.

Message 2 of 12
(7,159 Views)

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"?

0 Kudos
Message 3 of 12
(7,143 Views)

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,

Tom L.
Message 4 of 12
(7,136 Views)

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? 

0 Kudos
Message 5 of 12
(7,126 Views)

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, 

Tom L.
0 Kudos
Message 6 of 12
(7,096 Views)

Hi guangdew,

 

maybe you want to use ISO week numbering instead, it always starts with week 01... 😄

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 7 of 12
(7,068 Views)

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.

0 Kudos
Message 8 of 12
(7,056 Views)

@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

 

Jeffrey Zola
Message 9 of 12
(7,025 Views)

@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

Message 10 of 12
(7,014 Views)