Calander Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I am looking for help in elimating weekend and public holidays whilst using
the calendar object in a form. The following is the code so far. Any help
would be apprecialted.

<code>
private void UpdateStage_Click(object sender, System.EventArgs e)
{
double dblJD1 = Convert.ToDouble(JD1.Text);
double dblDD1 = Convert.ToDouble(DD1.Text);
double dblTD1 = (dblJD1 + dblDD1);
TD1.Text = dblTD1.ToString();
CD1.Text = DateAdder(StartDate1.Text,dblTD1);

}

private void FillStartDates(object sender, System.EventArgs e)
{
DateTime StartTime = JobStartCalendar.SelectedDate;
string strStartTime = StartTime.Day + "/" + StartTime.Month + "/" +
StartTime.Year;
StartDate1.Text = strStartTime;

}
public string DateAdder(string Date,double DaysToAdd)
{
string [] DateStuff = Date.Split('/');
int DateDay = Convert.ToInt32(DateStuff[0]);
int DateMonth = Convert.ToInt32(DateStuff[1]);
int DateYear = Convert.ToInt32(DateStuff[2]);
DateTime CurrentTime = new DateTime(DateYear,DateMonth,DateDay);
DateTime NewDate = CurrentTime.AddDays(DaysToAdd);
string strNewDate = NewDate.Day + "/" + NewDate.Month + "/" + NewDate.Year;
return strNewDate;
</code>
 
Back
Top