I'm using VS 2013 and VB language
My task is to store a user entered date in the format mm/dd/yyyy
Dim date1 As String = Format("MM/dd/yyyy")
Dim date2 As Date
Dim date3 As Date
date1 = Console.ReadLine()
date2 = DateTime.Now
date3 = DateTime.Parse(date1)
Console.ReadLine()
I first tried entering the date as Dim date1 as Date, but entering it in mm/dd/yyyy is invalid format.
So I tried this method, and get the error "String was not recognized as a valid DateTime"
How can I format the entered date so that it will be recognized as a valid datetime?
Thanks