string into a date object....

Posted on 2005-05-09
Last Modified: 2010-04-07
Is there an easy way to get a string in the format YYYY-MM-DD into a date object?

Question by:Weller0123
    LVL 44

    Accepted Solution

    in VB.NET, you can use the Date.Parse method to dop EXACTLY that:

     Dim strDate As String = "2005-05-23"
     Dim dtDate aDate
     dtDate  = Date.Parse(strDate)
    TextBox1.Text = dtDate.ToShortDate

    TextBox1 with  then hold "5/23/2005", and the variable dtDate  would hold the appropriate date value.


    Author Comment

    The parse method works perfectly.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    jquery, aspx 10 34
    Way to have hovering effect 4 42
    Add json string to a javascript object 9 34
    varchar (max) 5 22
    AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
    I have developed many web applications with asp & and to add and use a dropdownlist was always a very simple task, but with the new, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 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

    16 Experts available now in Live!

    Get 1:1 Help Now