String type to DateTime type conversion : Format Exception


I have a string in dd/mm/yyyy format. I just need to convert it to DateTime type.
No success using below,
DateTime(ParseExtract(“15/6/2018”, “dd/MM/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)

Error:Assign : String was not recognized as a valid DateTime.

Please help, Thanks!



Your input string is in format “dd/M/yyyy” that’s why it throws invalid datetime exception.
You can change the string format as “dd/M/yyyy”.


You can refer this link for more format options:
Custom Data and Time string format


Thanks Bharat!