Get StartDate and EndDate of Week From Week Number

Get StartDate and EndDate of Week From Week Number

  

Hi

I want to get start date and end date of given week.

i.e.

GetDates (weekNumber, Year) 

{

}

return   StartDate, EndDate

Can any one tell how can a achieve this.
I want to pass Year and week number and it should give me the date of Monday and sunday

Hi,


did you google for this?

Because this is typically not outsytems related.


J. wrote:

Hi,


did you google for this?

Because this is typically not outsytems related.



Hi J.

Thanks for quick reply.
please forget the C# code that I include as an example.
I just want this functionality in Outsystems Web.
I have a week number.
for example 35. I want to know about the is the start date(Monday) of this week and end Date(Sunay) of this week.

Hello Ali,


The quickest way for you to achieve this is create an OutSystems extension or look into the available forge components.


Happy (low)coding!

Hi Ali,

I have something that may help. You need to do an advance query with this

SyntaxEditor Code Snippet

SELECT DATEADD(wk, DATEDIFF(wk, 6, '1/1/' + @YearNum) + (@WeekNum-1), 6) AS StartOfWeek, DATEADD(wk, DATEDIFF(wk, 5, '1/1/' + @YearNum) + (@WeekNum-1), 5) AS EndOfWeek;

you need 2 imputs YearNum and WeekNum. YearNum needs to be expanded inline and the format needs to be this "'2008'". Look that I have a quote inside double quotes. This is the easy way but the best way would be implementing the algorithm yourself on outsystems or extension like this: https://stackoverflow.com/questions/19901666/get-date-of-first-and-last-day-of-week-knowing-week-number

Regards,

Marcelo