Forum Discussion

santoshthenge's avatar
santoshthenge
Occasional Contributor
6 years ago
Solved

aqConvert.DateTimeToFormatStr(aqDateTime.Today(),"%U") format is not work properly

 Hi All      aqConvert.DateTimeToFormatStr(aqDateTime.Today(),"%U") is return wrong week number.   Ex i have evaluate the function format on date 02.05.2018, So current week number is 18 but this...
  • tristaanogre's avatar
    tristaanogre
    6 years ago

    nice, will_fetherolf!  Then it's not a bug, just a misunderstanding of what's being returned.

     

    so, %U will still work, you just need to make sure that you add 1 to any result to get the ISO standard week number.

     

    However, it looks like %W is still what you're looking for.  Just did a quick check and %W does it's numbering starting with 1 while %U numbers starting with 0.  That's a documentation problem since %W also seems to note that the week numbering starts with 0.

     

    In short... use %W to get the ISO standardized week number with weeks starting on Monday and numbering starting with 1.