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. researched 1 Quote Link to comment Share on other sites More sharing options...
0 Aether 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~ researched 1 Quote Link to comment Share on other sites More sharing options...
0 Aether 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~ researched and SonoftheSun 1 1 Quote Link to comment Share on other sites More sharing options...
0 Aether 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...
0 IamNatoyThatLovesYou Posted January 22, 2023 Report Share Posted January 22, 2023 Hello Everyone, You can use this formula to get the week number. DatePart(week,[@field:Date]) - Natoy researched 1 Quote Link to comment Share on other sites More sharing options...
0 Queso Posted January 25, 2023 Report Share Posted January 25, 2023 Hi Everyone, Just to add, here is another forum post related to this topic: Quote Link to comment Share on other sites More sharing options...
0 Kronos Posted January 25, 2023 Report Share Posted January 25, 2023 Hi! adding these howto articles in case it might help you: https://howto.caspio.com/datapages/reports/advanced-reporting/calculated-fields-and-datediff-function/ https://howto.caspio.com/function-reference/#:~:text=Date and Time Functions The second one states that DatePart(week, date), SysDateTime() and SysteUTCDateTime() functions will not work in the formula field. 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
6 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.