Problem to copy date from ListBox

Hello group, I’m having problems in taking a data value from a listbox in the format dd / mm / yyyy and using it by passing it to a variable of type date, the string that gives me an error is this:

messagebox "My data" + datetime.FromString(dareavere.ListBoxDare.CellTextAt(row,3)).SQLDateTime

where am I wrong?

I think I understand that I should convert the date back to the YYYY-MM-DD format first?

What’s the error?

And how did the date get into the cell originally?

https://documentation.xojo.com/api/data_types/datetime.html#datetime-fromstring

Depends all on the input Format and the Locale Format.
Maybe this will help:

Var Berlin As New Locale("de-DE")
Var NewYork As New Locale("en-US")

Try
  
  MessageBox "My data " + DateTime.FromString("11/03/2022 13:33:00", NewYork).SQLDateTime
  MessageBox "My data " + DateTime.FromString("03.11.2022 13:33:10", Berlin).SQLDateTime
  MessageBox "My data " + DateTime.FromString("2022-11-03 13:33:10", Berlin).SQLDateTime // This should fail...
  
Catch err As RuntimeException
  
  // Wrong Format
  
End Try

I see that it is not necessary to convert to date type. A ListBox always saves data as text.

When you take it, you can convert it to another data type.