Solved

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

Posted on 2008-10-31
1
304 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

24 Experts available now in Live!

Get 1:1 Help Now