ngbatis
ngbatis copied to clipboard
class 'ResultSetUtil.java' parse datetime type error
Time transfer error. The internal time of the datetimeWrapper is UTC time. If the time zone is East Eighth Zone, it will be eight hours less
private static Object transformDateTime(DateTimeWrapper dateTime) {
// change here, maybe use localdateTime instead ?
DateTime localDateTime = dateTime.getLocalDateTime();
try {
CALENDAR_CONSTRUCTOR.setAccessible(true);
GregorianCalendar calendar = CALENDAR_CONSTRUCTOR.newInstance(
localDateTime .getYear(),
localDateTime .getMonth() - 1,
localDateTime .getDay(),
localDateTime .getHour(),
localDateTime .getMinute(),
localDateTime .getSecond(),
Math.floorDiv(localDateTime .getMicrosec(), 1000)
);
CALENDAR_CONSTRUCTOR.setAccessible(false);
return calendar.getTime();
} catch (Exception e) {
return new GregorianCalendar(
localDateTime .getYear(),
localDateTime .getMonth() - 1,
localDateTime .getDay(),
localDateTime .getHour(),
localDateTime .getMinute(),
localDateTime .getSecond()
).getTime();
}
}