Month number wrong in instance of clock

After creating an instant of clock (by Do it) The number of month in the resulting comment (java.util.GregorianCalendar[ ...) is
always the real number minus 1. By example the month january is indicated by MONTH=0.

If this is an error in the rendering of the comment than it does not matter but maybe it points to an underlying more severe error?

Java is 0 indexed
you might want to try the Month method from the clock component to get the value you are looking for
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

All the other parameters: YEAR, DAY_OF_MONTH, HOUR_OF_DAY, MINUTE, SECOND give the right number, only MONTH gives the number-1

This is how "10/19/2020 12:05:30" looks like

Do It Result: java.util.GregorianCalendar[time=1603101930000,areFieldsSet=true,lenient=true,zone=Europe/Brussels,firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=1,YEAR=2020,MONTH=9,WEEK_OF_YEAR=43,WEEK_OF_MONTH=4,DAY_OF_MONTH=19,DAY_OF_YEAR=293,DAY_OF_WEEK=2,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=0,HOUR_OF_DAY=12,MINUTE=5,SECOND=30,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=3600000]

Taifun

Thank you for the info.
So it is no bug after all.
Strange people these Java calendar implementers :wink:

by the way is there a way to close this topic now ?

Unbenannt
Taifun

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.