i have this error "input string not in correct format"

Recommended Answers

All 2 Replies

string start = book.CheckIn;
                string end = book.CheckOut;
                string[] temp = start.Split('/');
                int startMonth = Convert.ToInt32(temp[1]);
                int colStart = Convert.ToInt32(temp[0]);
                temp = end.Split('/');
                int colEnd = Convert.ToInt32(temp[0]);
                int year = Convert.ToInt32(temp[2]);

Are the CheckIn and CheckOut properties defined as strings or datetime? If they are datetime, did you try... book.CheckIn.ToString();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.