Take the 2-minute tour ×

i want to insert a string as date format in mysql table using vb.net.my code is given below.but i always get an error .the string is stored in an array.


Dim sdfsa As String = Convert.ToDateTime(newarray(i + 17)).ToShortDateString().ToString("yyyy-MM-dd")
Dim newdate As Date = DateTime.ParseExact(sdfsa, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture)
datarw("date_of_birth") = newdate
share|improve this question
add comment

2 Answers

Are the Users inputting this information directly?

if they are why don't you input have them input the value in a masked text box?

This Link Could Help

share|improve this answer
add comment

Try this:

my_date =Format(Now,"yyyy-MM-dd")
share|improve this answer
add comment

Your Answer


