Storing Twitter Formatted Date in Date Variable

I have code which is getting the xml from twitter of a twitter members status posts.  I am getting the data back fine however when I try to store the date data in a date variable it is saying it isn't a valid date.

The date comes in looking like this: "Wed Mar 30 16:25:57 +0000 2011" and when I try to Ctype that string into a date it is telling me it isn't valid....Any ideas?

The overal objective is to take that date and display it as an ISO 8601 date on the page, any help with that too would help.

CType(ds.Tables("status").Rows(0).Item("created_at").ToString(), Date)

Open in new window

Who is Participating?
RDurishAuthor Commented:
Awesome I will give that a shot.  On a sub note?  How do I output a date (once stored in the date variable)  as a ISO 8061?
You can use the ToString with a format.

I've this on CSharp

public static DateTime ParseDateTime(this string date)


        string dayOfWeek = date.Substring(0, 3).Trim();

        string month = date.Substring(4, 3).Trim();

        string dayInMonth = date.Substring(8, 2).Trim();

        string time = date.Substring(11, 9).Trim();

        string offset = date.Substring(20, 5).Trim();

        string year = date.Substring(25, 5).Trim();

        string dateTime = string.Format("{0}-{1}-{2} {3}", dayInMonth, month, year, time);

        DateTime ret = DateTime.Parse(dateTime);

        return ret;


maybe you can convert it in VB net easily, or i can still help you again
RDurishAuthor Commented:
Thanks perfect solution!  Worked like a charm!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.