I want to time from this type string
30-12-1899 14:32:54
string ReportTime = JobReportTime.Substring(9, 19);
but when I use Substring give me error “Index and count must refer to a location within the string.
Parameter name: count”
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Substring arguments are start position and length, not start and end index. You could use
.Substring(11, 8)but as Substring will just return the rest of the string if you don’t specify a length,.Substring(11)will give you what you’re after. Of course, you should probably consider parsing the string into aDateTimeand then extracting the time information, as others have suggested.