Click here to Skip to main content
15,907,687 members

why this is giving me wrong output

Latest Revision
C#
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: ,