Parse String to date error

Posted on 2012-08-31
Last Modified: 2012-09-05
Hi I am passing in a local date from javascript in the fomat 31/8/2012 11:29:19

But when I try to convert it into a valid date on the server side I get the error message "Date is not a recognised format"

My code is ........

Dim british = New CultureInfo("en-GB")
            Dim _localDate As Date = DateTime.ParseExact(localDate, "dd/MM/yyyy HH:mm:ss", british)

Would be grateful for any help.

Question by:Soluga
    LVL 83

    Expert Comment

    Have you tried with

    Dim _localDate As Date = DateTime.ParseExact(localDate, "dd/M/yyyy HH:mm:ss", british)
    LVL 1

    Author Comment

    Same error!
    LVL 1

    Accepted Solution

    This works....

    Dim _localDate As Date = Convert.ToDateTime(localDate)
    LVL 1

    Author Closing Comment


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    This video discusses moving either the default database or any database to a new volume.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now