I’m trying to convert string to DateTime format in the way shown below,
but all the tim getting error
“Assign: String was not recognized as a valid DateTime.”
Can you help me with this issue?
I’m trying to convert string to DateTime format in the way shown below,
but all the tim getting error
“Assign: String was not recognized as a valid DateTime.”
Can you help me with this issue?
Hi @Olivera_Kalinic ,
Can you use “d.M.yyyy” instead of “dd.MM.yyyy”
DateTime.ParseExact(“1.3.2022”,“d.M.yyyy”,System.Globalization.CultureInfo.InvariantCulture)
Note: If your input will be 01.03.2022. You can use “dd.MM.yyyy”
Thanks!
How about this Date expression?
DateTime.ParseExact("1.3.2022",{"d.M.yyyy","dd.MM.yyyy","M.d.yyyy","MM.dd.yyyy"}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None)
Regards
Gokul
I have to get date in format “dd.MM.yyyy”, not in “MM/dd/yyyy hh:mm:si”
Try with this expression
DateTime.ParseExact("1.3.2022",{"d.M.yyyy","dd.MM.yyyy","M.d.yyyy","MM.dd.yyyy"}, System.Globalization.CultureInfo.InvariantCulture,System.Globalization.DateTimeStyles.None).ToString("dd.MM.yyyy")
Regards
Gokul