Ugo DI LUCA Posted June 8, 2005 Posted June 8, 2005 Hi all, Pretty busy and lazy to think of it.. Knowing a starting date and ending date of a Project, I want to determine the starting Quarter Date and Ending Quarter Date, based on the classic Calendar, whatever the day is. So if project starts on feb 15 2005 and ends on November 11th 2007, I want the start date to be Jan 1st and end date to be Dec 31st 2007. If it starts on Jan 1 2004 and ends on Jan 15th 2007, then start date is Jan 1st and end date is March 31 as the quarter was initiated on Jan 15th If it starts on Dec 31 th, by default I want the start date to be Oct 1st even if we're just one day before end. Thanks for the help. I have that calc right now, but I'm not satisfied with the result Let ( [ P = pvs_SolutionParameters::sp_periodLength; md = Month (pd_dateStart) ; c_P = Plancher ( md / P + ,25 ) +1 ; M = 1+(P*(c_P-1)) ]; Date ( M ; 1 ; Year(pd_dateStart) ) ) P is just a parameter to switch from quarters to semester, but you can forget about it. Thanks
comment Posted June 8, 2005 Posted June 8, 2005 Hi Ugo, First day of current Quarter: Let ( [ m = Month ( date ) ; q = Div ( m - 1 ; 3 ) ; s = q * 3 + 1 ] ; Date ( s ; 1 ; Year ( date ) ) ) First day of next Quarter: Let ( [ m = Month ( date ) ; q = Div ( m - 1 ; 3 ) ; e = q * 3 + 4 ] ; Date ( e ; 1 ; Year ( date ) ) ) In pre-7 versions, instead of Div() use: Int ( ( Month ( date ) - 1 ) / 3 ) to compute q.
Ugo DI LUCA Posted June 8, 2005 Author Posted June 8, 2005 Thanks, That was quick enough. God I love this board, even my lazyness ! Well I did work at some othe stuff confidently waiting for an answer before the end of my working day... cheers.
Recommended Posts
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