Solved

Conversion from string "10/22/2008" to type 'Date' is not valid.

Posted on 2008-10-31
1
305 Views
Last Modified: 2012-05-05
Hi
In my ASP.NET 2.0 Visual Basic Webstie I try to do

incident.ResolutionDate = tbComDate.Text

where

Public Property ResolutionDate() As DateTime
            Get
                Return _resolutionDate
            End Get
            Set(ByVal Value As DateTime)
                _resolutionDate = Value
            End Set
        End Property

tbComDate.Text is "10/22/2008"
Anyone know how to format is correctly as the date format should be day month year but I'm passing it in as month day year (ie 10/22/2008)

Thanks
AM


 
0
Comment
Question by:amoran
1 Comment
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 20 total points
ID: 22850253
Try the Date.ParseExact method....

    incident.ResolutionDate = Date.ParseExact(tbComDate.Text, "mm/dd/yyyy", My.Computer.Info.InstalledUICulture)

Wayne
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…

832 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