chrisnta Posted December 21, 2008 Posted December 21, 2008 I have a problem where I need to calculate to the next date of a particular weekday. Let say: Start_Date = Monday, 8th December 2008 Period= 4 Weeks Calc_End_Date = Must be the weekday of the Start_Date in a Period of 4 weeks (=5th of January '09) If I use the Date Function, Day (Start_date + 28), it doesn't work always because it calculates the day not the weekday. How do I calculate the weekdays if I want to use the Date function? Thanks
comment Posted December 21, 2008 Posted December 21, 2008 If I use the Date Function, Day (Start_date + 28), it doesn't work always because it calculates the day not the weekday. It's not quite clear what you're doing there. Day (Start_date + 28) will give you the day-of-the-month of the target day, i.e. 5 using your example (Jan 5, 2009). If you do the same for the month and the year, you should get the correct result at the end. However, it's quite unnecessary to use the Date() function for this: Start_Date + 7 * Period should do the job.
chrisnta Posted December 21, 2008 Author Posted December 21, 2008 Sorry if it wasn't clear, Here my situation: I need to calculate when a contract is finished. I have a start date and a period. The end date must fall on the same weekday as the start weekday. So, I need to calculate Weekday times period (4 Weeks = 28 days). For me its not clear what to use to get the right result.
comment Posted December 21, 2008 Posted December 21, 2008 If the period is given as number of weeks then: Start_Date + 7 * Period will always be the same day-of-week as Start_Date (unless Period is a fraction...).
chrisnta Posted December 21, 2008 Author Posted December 21, 2008 I will test this tomorrow. Thank you for your help.
Recommended Posts
This topic is 5875 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now