I have asked this question before and used the soln but for some reason it just does not work this time around. Hopefully someone else can see the error/missing element. Iparse a date that is in string format and would like to convert it to a datetime format but cannot figure out how to do this. The date appears as such:
Tue May 08 20:38:42 +08:00 2012
here is my conversion code:
Dim postDate As DateTime = DateTime.ParseExact(contentDate, "ddd MMMM dd hh:mm:ss zzz yyyy", System.Globalization.CultureInfo.InvariantCulture)
contentDate = postDate.ToString("yyyy-MM-dd hh:mm:ss")
The error is on the first line : “String was not recognized as a valid DateTime “
Unfortunately, I believe the issue is that the date you have as your sample was not a Thursday, but a Sunday. In addition, I think you need to use capital letters for the Hour since it looks like you are getting military time.
Once I made these changes, it worked.