You might be interested in this example. You can easilly create an 'ok' button that will retrieve the set dates and times and closes the GUI.
Either close(fig) or delete(fig) will close the uifigure.
Note that you should consider using functions instead of script for anything you plan on using after next week. Functions provide an interface you can document and have their own workspace which is independent from the rest of the environment.