I would like to display a date in the future based off of a date a user enters in a date field as well as a choice they make out of a drop list.
Drop List (dl1) allows the user to select choices “1 week, 2 weeks, 3 weeks, 4 weeks” etc up to “9 weeks”. They have a date field (date1) that they input a date. I would like to place in a calculated read only date field that adds date1 + the result of dl1 – call this calc1 (set as a date field).
All the date codes I have found in searches always use the Date() function to call the current date – this will not work for me as I need to compare against a date the user enters into the form, not the current systems date.
I have placed a CALCULATE code in the calc1 that looks like this:
switch (dl1.rawValue)
{
case “1”:
this.rawValue = date1.rawValue + 7;
break;
case “2”:
this.rawValue = date1.rawValue + 14;
break;
}
And it would go on for all possible values in dl1. But of course this just appends the number 7 or 14 at the end of the date (if the date1 field was set to August 2, 2011 then the result I get is 2011-08-027 or 2011-08-0214).
Do I need to parse out the year, month, day out of date1 and do some manipulating that way? Or is there a handy date function already that can read a date value and add days into it?
Thanks!