Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class 'ResultSetUtil.java' parse datetime type error #240

Open
bobobod opened this issue Oct 7, 2023 · 4 comments
Open

class 'ResultSetUtil.java' parse datetime type error #240

bobobod opened this issue Oct 7, 2023 · 4 comments

Comments

@bobobod
Copy link

bobobod commented Oct 7, 2023

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();
    }
  }
@CorvusYe
Copy link
Collaborator

CorvusYe commented Oct 7, 2023

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

@bobobod
Copy link
Author

bobobod commented Oct 7, 2023

got it

@wey-gu
Copy link
Member

wey-gu commented Oct 7, 2023

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

@Monoradioactivo
Copy link

is this issue still available?

CorvusYe added a commit that referenced this issue Oct 23, 2023
fix:class 'ResultSetUtil.java' parse datetime type error #240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

4 participants