J
John
Hi
I am using the below code to assign a date (entered in uk format) to a
datetime variable.
Dim myDateTimeUK As System.DateTime
Dim ukCulture As CultureInfo = New CultureInfo("en-GB")
myDateTimeUK = System.DateTime.Parse(txtDOB.Text, ukCulture.DateTimeFormat)
The problem is that I get the 'System.FormatException: String was not
recognized as a valid DateTime' if the value of txtDOB.Text is 16/12/85
which is a valid uk. It however works if txtDOB.Text is 12/16/85 (us
format). What is the problem and how do I get the text box to accept a uk
format date?
Thanks
Regards
I am using the below code to assign a date (entered in uk format) to a
datetime variable.
Dim myDateTimeUK As System.DateTime
Dim ukCulture As CultureInfo = New CultureInfo("en-GB")
myDateTimeUK = System.DateTime.Parse(txtDOB.Text, ukCulture.DateTimeFormat)
The problem is that I get the 'System.FormatException: String was not
recognized as a valid DateTime' if the value of txtDOB.Text is 16/12/85
which is a valid uk. It however works if txtDOB.Text is 12/16/85 (us
format). What is the problem and how do I get the text box to accept a uk
format date?
Thanks
Regards