Hi
I want to check the given string value is correct format for converting into datetime variable before to convert into date time variable. But the value '05/03/2020 8:15:00' is showed as incorrect format . Please can you advise me where is the problem
eg: datetimestring ='05/03/2020 8:15:00' string clockeddate = log.AttendanceDate; string timeclock = log.Hrs + ':' + log.Mins; string datetimestring = clockeddate + " " + timeclock+":00"; DateTime dDate; bool isCorrectDateFormat = DateTime.TryParseExact(datetimestring, "dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out dDate); if(isCorrectDateFormat) { dDate = Convert.ToDateTime(clockeddate + " " + timeclock); }