Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you display Calendar's in Java in a human-readable way?

I have two array lists consisting of Calendar objects. I need these two lists to contain the same objects and in the same order - but this isn't the case. I ran the program on debugger mode to check the content of the lists but the object descriptions are gibberish. I just want to know if the year, month and day are the same at each step.

This is what my debugger shows:

enter image description here

When I click the arrow next to each index to reveal more information I still can't find what I need. Is there a way around this? Or perhaps there is another debugging tool that I am unfamiliar with? At this stage my debugging skills are limited to placing breakpoints and clicking the bug icon.

Appreciate any help.

like image 809
eyes enberg Avatar asked Jul 03 '16 17:07

eyes enberg


1 Answers

  • Right-click on one of those calendars.
  • Choose Customize data views...
  • Go to the second tab: Java data type renderers
  • Click the + icon and name your renderer (calendar, for example)
  • Type java.util.Calendar in the box "Apply renderer to objects of type..."
  • Check the radio button "Use following expression"
  • Type the following expression (for example): new SimpleDateFormat("yyyy-MM-dd").format(getTime())
  • Click OK.
like image 149
JB Nizet Avatar answered Oct 13 '22 01:10

JB Nizet