anil john

anil john

  • NA
  • 156
  • 210.4k

adding daya to date

Sep 17 2012 6:00 AM
i am working in windows applicatio, i have two fields startdate and duration, i want to calculate the terminal date,but i get the duration to be added to start date but it will not add sundays to startdate;i am attaching my code, plz help me wat editing i have to do in my code

ma code:


public  string FindTerminationDate(DateTime dtStartDate, int iDuration, string strDurationType)
  {
  string strTermination="";
  if (strDurationType == "Days")
  {
  return strTermination = dtStartDate.AddDays(iDuration).ToString("dd/MMM/yyyy");
  }
  else if (strDurationType == "Months")
  {
  return strTermination = dtStartDate.AddMonths(iDuration).ToString("dd/MMM/yyyy");
  }
  else if (strDurationType == "Years")
  {
  return strTermination = dtStartDate.AddYears(iDuration).ToString("dd/MMM/yyyy");
  }
  return strTermination;
  }

Answers (1)