Subject:Calculating a Date based on 4 Scenarios Author:chelsea drennan Date:07 Jan 2009 07:57 PM
I have a problem that I need to solve in v1.0 which as 4 scenarios as described below.
- The variabe is the Vest Date. The only valid values for this are the 1st and 15th of the month accordingly.
There are a couple of unique cases which I need to transform
o Vest Date that occurs on the 1st, the date remains the 1st – aka 04/01/2008
o Vest Date that occurs between the 2nd – 15th, the date is merely rounded to the 15th. 04/15/2008
o Vest Date that occurs between the 16th – 31st, the date is merely rounded to the 1st of the following month. 05/01/2008 (A month gets added and the day to 1)
o And in the most rare of cases, if the Vest Date is between the 16th and 31st of December, the day is the 1st, month is the 1st, and year is added by 1. 12/26/2008 --> 01/01/2009
I am trying to determine the best way, or a way at all, to accomplish the following scenarios using if/when/choose statements. The main problem I see is that I have to extract all the data into variables - ie Month, Day, and Year, calculate based on those, and then reinsert those values.