Adding / Removing: days, month or Years to Date
private function addToDate(date:Date):Date { switch (period_cb.selectedLabel) { case "Day": var temp:Date = new Date(date.getFullYear(),date.getMonth(),date.getDate() + Number(valueDate_ti.text)); break; case "Week": var temp:Date = new Date(date.getFullYear(),date.getMonth(),date.getDate() + Number(valueDate_ti.text) * 7); break; case "Month": var temp:Date = new Date(date.getFullYear(),date.getMonth() + Number(valueDate_ti.text),date.getDate()); break; case "Year": var temp:Date = new Date(date.getFullYear() + Number(valueDate_ti.text),date.getMonth(),date.getDate()); break; } return temp; }
valueDate_ti is a text input that accept numbers to add to the date,
period_cb is a ComboBox, which selects the cycle time: Day, Week, Month, Year;
Leave a Comment