I have created an Employees database table with a Birthdate TIMESTAMP field (for maximum compatibility across SQL brands). I want to be able to set, display, edit and update this field, but also allow it to remain unentered.
The SQL database side is OK, it is the Xojo IDE field that is of most concern. The Date Picker must have an actual date as the default, and todays date as default would be incorrect. How can I tell if the date picker has been updated unless I choose a non-real birth date as default? BTW I am ignoring the HH:MM:SS fields.
I have tried:
- Setting the default date to 01-01-01, but my DatePicker doesn’t like dates before 1600.
- Setting the default date to 9999-01-01, but the RowSet returns this as date 1900-01-00, which doesn’t even exist and causes an exception “Parse error: date needs to be in the format of YYYY-MM-DD HH:MM or YYYY-MM-DD”, even though it is!
- If I set the Birth Date as a String in the database with blank as unentered, what date do I default the Date Picker as?
Var tempDate As DateTime = DateTime.FromString("9999–01-01 00:00:00") 'gives an Exception
Why is 9999–01-01 00:00:00 an invalid DateTime?
Should I set the default date to 3000-01-01 or some other date in the past/future?