Malinda Peiris
Malinda Peiris

Reputation: 43

get date and display in a lable? And how can i convert it to a string(date)

I want this date which have picked form jdateChooser to converted into string and displayed init jlable

java.util.Date date = jDateChooser1.getDate();
date.toInstant();
jLabel16.setText(date);

Upvotes: 1

Views: 68

Answers (1)

Gherbi Hicham
Gherbi Hicham

Reputation: 2584

Use the toString() method, it converts an object to a String, do this jLabel16.setText(date.toString()); to display the contents of the object in the label.

Upvotes: 1

Related Questions