I have a string in dd/mm/yyyy format. I just need to convert it to DateTime type.
No success using below,
Convert.ToDateTime
DateTime.Parse
DateTime(ParseExtract(“15/6/2018”, “dd/MM/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)
Error:Assign : String was not recognized as a valid DateTime.
@Marcelino
DateTime.ParseExtract(“15/6/2018”, “dd/MM/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat) will work if you use the correct date format as follows
DateTime.ParseExtract(“15/6/2018”, “dd/M/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat) or
DateTime.ParseExtract(“15/06/2018”, “dd/MM/yyyy”,System.Globalization.CultureInfo.CurrentUICulture.DateTimeFormat)