String Date to DateTime variable

How could I change a String with this format:

Monday, November 26, 2007

to a DateTime variable?
With the format: “MM/dd/yy”


I was using: DateTime.ParseExact(Date,“dddd, MMMM dd, yyyy”,System.Globalization.CultureInfo.InvariantCulture) to change to DT variable and after that changing that to the format I want, but is not working, any other way to do this?
With “Date” being the variable with the string. as mentioned above.

i dont know what you are doing wrong but that parsing is perfectly fine for that date format… maybe you have an extra white space in your string… try using Trim on it before parsing.

Yea it appears that it was the spaces, thank you.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.