Retrieve the date that the user selected by calling getDate()
, which returns a Date
object. Then convert that object into a String
by calling SimpleDateFormat.format()
:
Date d;
SimpleDateFormat sdf;
String s;
d = dateChooser.getDate(); // Date selected by user
sdf = SimpleDateFormat("MM/dd/yyyy HH:mm:ss"); // Or whatever format you need
s = sdf.format(d); // Viola
See also: Question 5683728