zxx23
zxx23

Reputation: 1

getText() method not showing in dateChooser in java

Image 1 Image2 Image 3

I want to use the JDateChooser. and i want to get the text inside it. I saw in yt tutorials and asked my friend abt it. He told me that he can use the getText(). idk why i cant use it in mine.

tried using the getDate().toString(). but the time format is different. The time format that i chose is yyyy-MM-dd. But the display date is Fri Jan 01 01:01:23 PST 9999

Upvotes: -2

Views: 76

Answers (1)

JeslynTan
JeslynTan

Reputation: 46

Try DateFormat instead of toString() directly

DateFormat formatter = new SimpleDateFormat(yyyy-MM-dd);
formatter.format(getDate());

Upvotes: 0

Related Questions