The reason is whenever you try to convert a string to datetime format, kindly change it in the same format like if you have string in 2019/02/26, change it to yyyy/MM/dd, not like we need like MM/dd/yyyy. It should match between the string and the dateformat and there are two options to do that one is parse and parseexact. To better know about this kindly refer to this link
Hope this would help you,if so buddy kindly close this thread with comment marked as solution that could help others looking for ideas under you topic
Cheers…