sammi taylor

sammi taylor

  • NA
  • 19
  • 0

C# Convert int fiscalYear to datetime or datetimepicker

Jan 24 2014 2:16 PM


This is what I started. I have a CaseOpened date that restricts dates to fiscalYear date but no future dates allowed. 

int fiscalYear;

if (MyCase.CaseOpened.Month >=7)

fiscalYear = MyCase.CaseOpened.Year +1;



//Use fiscalYear in datetimepickers for min/maxdate. My fiscal year runs from july of previous year to july of this year. Today's date is the maxDate, past dates from July of last year to today's date can be entered for minDate. I don't know how to manipulate date with If Else.

datetimepicker1 maxDate = datetime.today;

datetimepicker1 minDate = fiscalYear date + maxDate; 

if (MyCase.CaseOpened == null)

{

myCase.CaseOpened=minDate;

MyCase.CaseOpened=maxDate;

}

else

error msg, "Future dates are not allowed."


Please help. I could be doing it all wrong. Thank you in advance.



else
fiscalYear = MyCase.CaseOpened.Year;

Answers (2)