Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
dotnetfan
Contributor III
Contributor III

Weekname returns week number in 2021

Hello,

 

I tried to get the week number based on the datetime, however, when I execute following script then I found the week number is not correct:

 

Let vWeekNumber = WeekName('2021/1/1')  => returns: 2021/01 (However based on the calendar in Outlook, 2021/1/1 should be considered as the week 53, 2020,)

Let vWeekNumber = WeekName(Today())  => returns: 2021/07 (it should be week 6)

Does anyone can help me to solve this issue?

 

Thanks,

Dotnetfan

4 Replies
AdiPai
Creator II
Creator II

Try this 

Let vWeekNumber = Week(Today());

dotnetfan
Contributor III
Contributor III
Author

Thank you, I tried to run your code but the current week number is 7. As you can see: 

dotnetfan_0-1612951169483.png

 

Almen
Creator II
Creator II

Check if you have these variables set:

 

 

SET FirstWeekDay=0;
SET BrokenWeeks=0;
SET ReferenceDay=4;

 

Gabriel
Partner - Specialist III
Partner - Specialist III

HI,

Check how your Global variables are defined in the Main tab, like below;

SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='$#,##0.00;-$#,##0.00';
SET TimeFormat='h:mm:ss TT';
SET DateFormat='M/D/YYYY';
SET TimestampFormat='M/D/YYYY h:mm:ss[.fff] TT';
SET FirstWeekDay=6;
SET BrokenWeeks=1;
SET ReferenceDay=0;
SET FirstMonthOfYear=1;
SET CollationLocale='en-US';
SET CreateSearchIndexOnReload=1;
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET LongMonthNames='January;February;March;April;May;June;July;August;September;October;November;December';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET LongDayNames='Monday;Tuesday;Wednesday;Thursday;Friday;Saturday;Sunday';
SET NumericalAbbreviation='3:k;6:M;9:G;12:T;15:P;18:E;21:Z;24:Y;-3:m;-6:μ;-9:n;-12:p;-15:f;-18:a;-21:z;-24:y';