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

RDurishAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
0
CodeCruiserCommented:
You can use the ToString with a format.

MyDate.ToString("yyyyMMdd")
0
NeuropsykopatCommented:
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
0
RDurishAuthor Commented:
Thanks perfect solution!  Worked like a charm!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.