FinTheHuman Posted July 24, 2019 Report Share Posted July 24, 2019 Hi Guys, Is there a way for me to know what week number does the selected date for the month? Thanks for the help. Quote Link to comment Share on other sites More sharing options...
0 WatashiwaJin Posted July 24, 2019 Report Share Posted July 24, 2019 Hi @FinTheHuman - you can use this formula to get the specific number of the week for the current month selected in your DATE field: DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1 I hope this helps ~WatashiwaJin~ Quote Link to comment Share on other sites More sharing options...
0 WatashiwaJin Posted July 24, 2019 Report Share Posted July 24, 2019 Hi @FinTheHuman - In addition for the earlier response, you can also use this formula to get the week number with the corresponding month via DataPage level: CASE WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 1 THEN 'Week 1 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 2 THEN 'Week 2 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 3 THEN 'Week 3 of ' + (DATENAME(month, [@field:DATE])) WHEN (DatePart(day, DateDiff(day, 0, [@field:DATE])/7 * 7)/7 + 1) = 4 THEN 'Week 4 of ' + (DATENAME(month, [@field:DATE])) ELSE 'Week 5 of ' + (DATENAME(month, [@field:DATE])) END ~WatashiwaJin~ SonoftheSun 1 Quote Link to comment Share on other sites More sharing options...
0 WatashiwaJin Posted July 24, 2019 Report Share Posted July 24, 2019 You can also check this articles for further information: https://www.codeproject.com/Questions/1248034/How-to-get-the-week-number-of-a-month-in-SQL https://howto.caspio.com/function-reference/ Quote Link to comment Share on other sites More sharing options...
Question
FinTheHuman
Hi Guys,
Is there a way for me to know what week number does the selected date for the month?
Thanks for the help.
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.