How to find the difference between the dates from two different jdatechooser? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to find the difference between the dates from two different jdatechooser?

please explain with the code if possible. thank you.

22nd Apr 2017, 5:04 AM
Bibek Karki
Bibek Karki - avatar
1 Answer
+ 7
As far as I know, JDateChooser returns a string containing the date. So you could use: DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); // enter pattern that matches the string! Date date = df.parse(yourDateString); Then you can simply substract two dates, you parsed before.
27th Apr 2017, 5:07 AM
Tashi N
Tashi N - avatar