I am trying to convert a string to DateTime, MM/dd/yyyy, and get the month, however, I am getting the error
Assign - String was not recognized as a valid DateTime.
This is the string it cannot convert “04/30/2022”.
You have missed yy in the expression
You’re overcomplicating it.
This will also do @Nelson.R
If the date string is standard MM/dd/yyyy you don’t need ParseExact and all that extra stuff. Datetime.Parse just uses your system format.
what about this
with this you have 9 less chars to type (just having fun)
just trying to dive into “who can write least possible code for same result”
Thanks. When reviewing all my data some dates had a different date format so I had to make changes somewhere else in my code to keep a single format for all the dates.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.