Saving and Loading hours/minutes for the calendar object

Next to the DesktopDateTimePicker date, I would like to save the hours and minutes from the DataTimePicker to the database as well, but can’t figure out how this would work. Saving the date to and from the database table is no problem, so I assume I should somehow add the Hour/minutes property to it?

This is the code I use for saving to the database table:

var SelectedDate as string
SelectedDate = WinStoryCalendarEvents.DateTimePickerEvents.SelectedDate.SQLDate
App.db.ExecuteSQL("UPDATE events SET EventDate = ? WHERE ID = ?", SelectedDate, EventID_Selected)

This is the code in the listbox that reads the date back from the DataTimePicker:
DateTimePickerEvents.SelectedDate = rs.Column("eventdate").DateTimeValue

Where do I add the code for the hours and minutes?

I love btw how this look in the App: :slight_smile:
Screenshot 2022-10-31 at 15.32.40

A DateTime includes the time (hours, minutes, seconds). When storing the value, do not use SQLDate as that is just the date. If you provide the DateTime object to the statement instead of a String value of the SQLDate Xojo will automatically insert the time.

var dtSelected as DateTime = DateTimePickerEvents.SelectedDate
DB.ExecuteSQL("UPDATE ...", dtSelected)

Alternatively, if you’d like to continue doing this with strings, you want the SQLDateTime property.

Thanks Tim. It works now. I had trouble to get the db data being read back into the clock object when clicking on the Listbox row for that clock display, but after updating the DateTimePicker Object to the DesktopDateTimePicker version, it started to read the time back as well.