Hello everyone,
I am extracting a Date and saving the value as generic type. Since I have to do a comparison with some other date, I need to convert it to DateTime but I am getting an error. Any ideas on how to solve this?
Thank you!
Hello everyone,
I am extracting a Date and saving the value as generic type. Since I have to do a comparison with some other date, I need to convert it to DateTime but I am getting an error. Any ideas on how to solve this?
Thank you!
Hi
this expression would help you that
Datetime.Parse(yourvariable) \\if we dont know the format of date
Datetime.ParseExact(yourvariable.ToString,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture) //if we know the format of date we have it can be any format but we need to mention that exact format in the second argument instead of “dd/MM/yyyy”. i took this format taking assumption that your variable is with that format “20/12/2019”
Kindly try this and let know for any queries or clarification
Cheers @rjackson
If the input string is in this format
str_input = “11/12/2019”
Then
str_output = DateTime.ParseExact(str_input,”MM/dd/yyyy”,System.Globalization.CultureInfo.InvariantCulture).ToString(“MM/dd/yyyy”)