How to find the date difference from 2 fields.

Hi  i have a question and i would really love to get help.  i currently allow user to select a start and a end date. with this information i want to calculate the number of days.   I have tried coding this myself but i keep getting errors.

string startDtStr = this.getProperty("start_date","");
string endDtStr = this.getProperty("end_date","");

if (startDtStr =="" || endDtStr=="")
return inn.newError("Select a Start and a End Date");
DateTime startDt = DateTime.Parse(startDtStr);
DateTime endDt = DateTime.Parse(endDtStr);
string durationStr = this.getProperty("duration");
int duration = (int)(endDt - startDt).TotalDays
It  gives me a number of errors and it just doesnt like the code. 
Can someoene please help me.  
Thank you. 
Parents Reply Children
No Data