How to save Date Picker details in Order Database

Hi All!
I’m very new to all of this. I have managed to add a date picker to the “Cart Page” for the customer to pick their delivery date and also a seperate time picker to allow them to select a time. How do I add what date and time the customer has selected to their order details?
Is it then possible to add this date and time to the “Thank You Page” and also the order confirmation email? Hoping someone is able to point me in the right direction! Thanks.

Thank you for your response, I had a go at following your steps but I got stuck at the first step. I’m getting an error with the “document” part of the code. Can you please assist?

To add the selected date and time from the date picker and time picker to the order details, Thank You Page, and order confirmation email, you need to capture the customer’s inputs and store them in the database or session variable.

Retrieve this information to display on the Thank You Page, and modify the email templates to include the date and time for the order confirmation email. Ensure to handle data securely and follow best practices throughout the implementation process.