Does anyone know how to grab or create the cdate value from Date? I haven't been able to figure out how to do so and I don't know how to necessarily get it. In the Date class it is there as
private transient BaseCalendar.Date cdate; I don't see an option to grabt the field from the Date object itself.
I am setting this date using request.setGatewayEndTime(Calendar.getInstance().getTime());
where the calendar is from the java.util.Calendar import
As commented, trying to access internally defined fields that were intentionally hidden from outside calling programmers would be unwise.
As commented, you seem to have an XY Problem. I'll take a stab at what you might need.
You are using terrible date-time classes that were years ago supplanted by the modern java.time classes defined in JSR 310. Never use
Calendar,Date, etc.You claim to have a call to a method requiring a
java.util.Dateobject that represents the current moment as seen in UTC, that is, with an offset of zero hours-minutes-seconds. To capture the current moment, useInstantclass.I suggest you educate the author of that called method about how
Datehas been replaced byInstant.Until they update their API, you can easily convert between legacy and modern classes by calling conversion methods added to the old classes.
As for the
BaseCalendar.Datefield, if your goal is to get a string in ISO 8601 format similar to the string you show in your screenshot which is nearly in standard format but omits the COLON from between the hours and minutes of the offset, then simply callInstant#toSting. The java.time classes use ISO 8601 format by default when parsing/generating strings.Your screenshot uses another offset other than zero. If you wish to see a moment with the offset of a particular time zone, apply a
ZoneIDobject to produce aZonedDateTimeobject.Produce text in standard ISO 8601 format that has been wisely extended to include the name of the time zone in square brackets.