Convert string to date?? Help???
-
Hi everyone, I am trying to convert a string format date e.g "13/07/2006" to a date. I am getting an error "String was not recognized as a valid DateTime". How can i convert it to "MM/dd/yyyy" format. Please reply thanks, Sanded
-
Hi everyone, I am trying to convert a string format date e.g "13/07/2006" to a date. I am getting an error "String was not recognized as a valid DateTime". How can i convert it to "MM/dd/yyyy" format. Please reply thanks, Sanded
-
Hi everyone, I am trying to convert a string format date e.g "13/07/2006" to a date. I am getting an error "String was not recognized as a valid DateTime". How can i convert it to "MM/dd/yyyy" format. Please reply thanks, Sanded
:cool:hey u can use any of this... 1.FormatDateTime(frDate, DateFormat.ShortDate) 2.cDate(frdate) this is best method to convert ur string . Parag
-
Hi everyone, I am trying to convert a string format date e.g "13/07/2006" to a date. I am getting an error "String was not recognized as a valid DateTime". How can i convert it to "MM/dd/yyyy" format. Please reply thanks, Sanded
first import System.Globalization namespace 'create an object of culture info Dim myCI As New CultureInfo("en-US", False) 'take culture info's clone Dim myCIclone As CultureInfo = CType(myCI.Clone(), CultureInfo) 'customise its date pattern myCIclone.DateTimeFormat.DateSeparator = "/" myCIclone.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy" 'parse date string with this pattern DateTimePicker1.Value = DateTime.Parse("13/07/2006", myCIclone.DateTimeFormat) and u have done !;) milan
-
first import System.Globalization namespace 'create an object of culture info Dim myCI As New CultureInfo("en-US", False) 'take culture info's clone Dim myCIclone As CultureInfo = CType(myCI.Clone(), CultureInfo) 'customise its date pattern myCIclone.DateTimeFormat.DateSeparator = "/" myCIclone.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy" 'parse date string with this pattern DateTimePicker1.Value = DateTime.Parse("13/07/2006", myCIclone.DateTimeFormat) and u have done !;) milan
thanks milanatdigi, Your solution was helpful. While the Solution provided by other guys created the same error message but i really appreciate their help as well. thanks, Sanded