I’m working with MySQL. Here is a test that mimics the issue:
- MySql date format
TextField2.Text = "2016-06-01"
Displays as: 2016-06-01
- Convert date to short date
Dim d As New Date
d.SQLDate = TextField2.Text
TextField2.Text = d.ShortDate
Displays as: 6/1/2016
- Save date back to MySQL
Dim Date As String = TextField2.Text
Dim d As New Date
d.Year = Val(Mid(Date,7,4))
d.Month = Val(Mid(Date,1,2))
d.Day = Val(Mid(Date,4,2))
TextField2.Text = d.SQLDate
Displays as: 0016-06-01 // Which is completely wrong.
So what is the proper way to handle dates in such a situation?