Click here to Skip to main content
15,893,904 members

why this is giving me wrong output

Revision 1
DateTime date = DateTime.Now;
string str="";
date =Convert.ToDateTime(dtl.Rows[0]["createddate"].ToString());
str = date.ToString("mm/dd/yyyy");


DateTime datenow = DateTime.Now;
string strnow="";
strnow = datenow.ToString("mm/dd/yyyy");
if (str != strnow)
{

}

//this gives me wrong month for both string variable why? and what is solution for that?
Posted 23-Nov-12 5:08am by sumit kausalye.
Tags: ,