ngbatis icon indicating copy to clipboard operation
ngbatis copied to clipboard

class 'ResultSetUtil.java' parse datetime type error

Open bobobod opened this issue 2 years ago • 4 comments

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();
    }
  }

bobobod avatar Oct 07 '23 09:10 bobobod

Hi, @bobobod Sorry, I lost the timezoneOffset before. Looking forward to your PR ~

Recently, there is a Hacktoberfest activity, and I ask if the bug-fixed PR could participate in the activity.

cc: @wey-gu

CorvusYe avatar Oct 07 '23 09:10 CorvusYe

got it

bobobod avatar Oct 07 '23 10:10 bobobod

I think so, too!

Hi, @bobobod Sorry, I lost the timezoneOffset before. Looking forward to your PR ~

Recently, there is a Hacktoberfest activity, and I ask if the bug-fixed PR could participate in the activity.

cc: @wey-gu

wey-gu avatar Oct 07 '23 17:10 wey-gu

is this issue still available?

Monoradioactivo avatar Oct 07 '23 19:10 Monoradioactivo