Can you edit any other value?
The user decides the date entered and inserts it in the dd-mm-yyyy format.
But now the database is full of data and the format stored has always been yyyy-mm-dd 00:00:00
Can you expand a little what âit doesnât workâ means?
Do you get a database error? an Exception? is something saved on the database but not the date that you want?
screenshot of the debuggerâŠ
These are definitely formatting errors.
When I read I need to read dd-mm-yyyy, when I write the date entered by the user in the format dd-mm-yy or dd-mm-yyyy I have to save it as yyyy-mm-dd 00.00.0.0
The screenshot provides the answer, you are trying to use DateTime.FromString with the option to use SQLDate/SQLDateTime and not your locale format.
See the documenation:
https://documentation.xojo.com/api/data_types/datetime.html#datetime-fromstring
You need something similar to:
Var myDate3 As DateTime = DateTime.FromString(dateValue, Locale.Current, TimeZone.Current)
Var myDate3 As DateTime = DateTime.FromString(dateValue, Locale.Current)
is enough
As my locale is not Italy, I need to create a locale for testing.
var l as new Locale("it-IT")
var s as string = "15-11-2024"
var d as DateTime = DateTime.FromString(s, l)
if you want to share your application, you need to make sure that the user input the dates correctly before using .FromString, as you can get exceptions if they input wrong dates.
Many thanks Antonio, thatâs how it works.