Not sure how to convert this date. 30-APR-2022. I need for it to read 04-30-2022.
It’s important to understand that “04-30-2022” is a string, not a datetime. Datetimes don’t have formats. They store a datetime value. You get the value out as a string, in whatever format you want.
That said, use Datetime.ParseExact(“30-APR-2022”,“dd-MMM-yyyy”,System.Globalization.CultureInfo.InvariantCulture) to parse the string date into an actual datetime.
Then if you want to output it as 04-30-2022 you use yourDateTimeVar.ToString(“MM-dd-yyyy”)
You can, of course, put this all together in one expression:
this was perfect, thank you. I had to put it in one expression because it needed to be a string. But this was exactly what I needed. I appreciate the help.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.