bbud Posted August 20, 2010 Posted August 20, 2010 Probably a newbie question... because I am, and I am looking for an easy answer. I have a begin date and an end date field, but I want to have the entries that are made in these two fields return the Week Begin Date and End Date to their respective fields. Now to the books. Thanks in advance for any support.
wireshop Posted August 20, 2010 Posted August 20, 2010 Not sure exactly what you want here but I use this formula to get the first day of the week: FirstDayOfWeek = CurrentDate - DayOfWeek(CurrentDate) +1 Make sure your calculation returns a date. You can tweak this to get different days of the week.
Lee Smith Posted August 20, 2010 Posted August 20, 2010 You are right, it isn't really clear what the end results should be. You can calculate the dates between a start and end date, or you can calculate what the first day of the week is for a given date (and the last day of the week), or the dates of a work week. [color:red]bbud How about telling us what you want to be as the result of your calculations? i.e. Start Date, End date (range of dates between, range of workdays between)? Monday for Start Date Friday for End Date HTH Lee
bbud Posted August 20, 2010 Author Posted August 20, 2010 (edited) thanks for replying. Sorry for not making my request clear. let me try to clear it up, given the following entries in a field: Start date: Wed, 8/18/2010 End date: Thur, 8/19,2010 I want the following: Week Begin Date: Given the start date, I would like this field to be calculated based on the entry in the start date field. Week End Date: This one is actually a begin date + 4, so I have this one. However, if you know how to calc the week begin and end date given the start date entry, that would be cool to know. Thanks, Bud Edited August 20, 2010 by Guest
comment Posted August 20, 2010 Posted August 20, 2010 wireshop already gave you the answer: WeekBeginDate = StartDate - DayOfWeek ( StartDate ) + 1 This is assuming your week begins on Sunday.
bbud Posted August 21, 2010 Author Posted August 21, 2010 Thank you to all the respondents. I used the calculation provided (field names modified) and made a slight modification described below. To the previously repliers, thanks again, and what I post is probably obvious to you. I post my actions and results to help others who may be as new as me. EventBegin - DayOfWeek ( EventBegin) + 2 The above was entered in the calculation field and a + 2 was used instead of the + 1 suggested to return my week begin date as the Monday of the week. Figured that one on my own. Watch outs. I originally did not have the little drop down below the formula entry field set to date, which of course returned undesirable results. Thanks again to everyone that replied.
comment Posted August 21, 2010 Posted August 21, 2010 Not sure if it matters to you, but it should be noted. Your calculation = date - DayOfWeek ( date ) + 2 returns the Monday of the week, with the week beginning on Sunday - not the first day of the week that begins on Monday. The difference is that when date is Sunday, the result is the following Monday instead of the previous one.
bbud Posted August 21, 2010 Author Posted August 21, 2010 (edited) wow, thanks for that. 99.9% of the time, it won't matter, but you know how that goes. Sounds like I need to ask how they want to want to account the rare events that do occur on the weekend. However, testing using the + 2 in my equation, a Saturday event registers the Begin Date as the previous Monday, and Sunday start event registers (as you stated) the following Monday. In essence, the Sunday would be the start of the week for the Monday that is being displayed, and it should not matter. While the Saturday result refers back to the previous week, which is consistent. Thanks again for making think that one through, but as always, needed to double check how they want it recorded. Edited August 21, 2010 by Guest
Recommended Posts
This topic is 5266 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