I parse 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;
Wed April 18 08:00:04 +08:00 2012
and would like it in a simple form of
2012-04-18 08:00:00
Code:
Dim postDate As DateTime
Dim provider As CultureInfo = CultureInfo.InvariantCulture
contentDate = Regex.Replace(contentDate, "\+", "")
Dim format As String = "ddd MMMM dd HH:mm:ss zzz yyyy"
postDate = DateTime.ParseExact(contentDate, format, provider)
contentDate = postDate.ToString("yyyy-MM-dd hh:mm:ss tt")
any ideas appreciated