Skip to content
Advertisement

Get Current Week/Month Dates

I want to make function get dates of current week. I will pass week start date number dynamically.Week start date can change.It can be sunday or monday or any day.I shoud be able to pass week start date number dynamically.

If i Call function GetCurrentWeekDates(weekStartDay NUMBER,callingday Date),i should get the result like the following

GetCurrentWeekDates(1,’10/04/2022′) –1 is sunday

Result should be as following

and when GetCurrentWeekDates(1,11/04/2022) –1 is sunday

Result should be as following

and when GetCurrentWeekDates(1,’14/04/2022′) –1 is sunday

Result should be as following

Similarly

I want to make function to get dates of current month. I will pass month number dynamically

If i Call function GetCurrentMonthDates(monthNumber NUMBER,callingday Date),i should get the result like the following

GetCurrentMonthDates(4,’01/04/2022′) 4 is April

Result should be as following

GetCurrentMonthDates(4,’16/04/2022′) 4 is April

Result should be as following

Advertisement

Answer

Here’s a week option; I’ll let you write the month function yourself (shouldn’t be too difficult, now that you know how).

Testing:

Some more testing:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement