Code Error
Posted: Tue Jan 13, 2015 12:14 pm
public void funcDateManipulation(string todaydate, string adddate, string subdate, string addmonth, string submonth, string spare1, string spare2)
{
string strYear = System.DateTime.Now.Year.ToString();
string strMonth = System.DateTime.Now.Month.ToString();
string strDay = System.DateTime.Now.Day.ToString();
double newdate;
int month;
// string output;
bool output;
output = string.IsNullOrEmpty(adddate);
if (!output )
{
newdate = Convert.ToDouble(adddate);
System.DateTime newcheckdate = System.DateTime.Now.AddDays(newdate);
strDay = newcheckdate.Day.ToString();
}
output = string.IsNullOrEmpty(addmonth);
if (!output )
{
month = Convert.ToInt32(addmonth);
System.DateTime newcheckdate = System.DateTime.Now.AddMonths(month);
strMonth = newcheckdate.Month.ToString();
}
//strDay = newdate.ToString();
pmanipulateddate = strDay + "/" + strMonth + "/" + strYear;
}
I'm getting error "string not in correct formate" I don't know whats the mistake inthis code... pmanipulateddate is variable defined in the module variable....pls let me know how to check not null in if statement....
{
string strYear = System.DateTime.Now.Year.ToString();
string strMonth = System.DateTime.Now.Month.ToString();
string strDay = System.DateTime.Now.Day.ToString();
double newdate;
int month;
// string output;
bool output;
output = string.IsNullOrEmpty(adddate);
if (!output )
{
newdate = Convert.ToDouble(adddate);
System.DateTime newcheckdate = System.DateTime.Now.AddDays(newdate);
strDay = newcheckdate.Day.ToString();
}
output = string.IsNullOrEmpty(addmonth);
if (!output )
{
month = Convert.ToInt32(addmonth);
System.DateTime newcheckdate = System.DateTime.Now.AddMonths(month);
strMonth = newcheckdate.Month.ToString();
}
//strDay = newdate.ToString();
pmanipulateddate = strDay + "/" + strMonth + "/" + strYear;
}
I'm getting error "string not in correct formate" I don't know whats the mistake inthis code... pmanipulateddate is variable defined in the module variable....pls let me know how to check not null in if statement....