I got these two strings. strA=“31/01/2021” and strB=“01.31.2021”. Now I make strA to a DateTime variable by doing that: dateA=DateTime.ParseExact(strA,“dd/MM/yyyy”,System.Globalization.CultureInfo.InvariantCulture)
Now my question - how can I make strB be the same as dateA? what do I have to “use” on strB? Is there a simple easy solution?
What do you mean make them the same? Both are strings, not datetimes. Datetimes don’t have a format - they store a value. Just like how numeric datatypes don’t have formats. You apply a format when outputting them as a string.
If you want to parse strB into a datetime, you do it the same way, but provide the format for strB.