我试图将axis.types.Time转换为sql.Time,如下所示:
org.apache.axis.types.Time axisTime = (org.apache.axis.types.Time) valore;
Calendar calendarTime = axisTime.getAsCalendar();
java.sql.Time jsqlT = java.sql.Time.valueOf( cal.get(cal.HOUR_OF_DAY) + ":" + cal.get(cal.MINUTE) + ":" + cal.get(cal.SECOND) );
但我在转换之间有一个小时的差异。这与日光有关吗?我该如何解决?
(输出:轴时间:20:45:00.000Z
日历 :java.util.GregorianCalendar[time=-62167403700000,areFieldsSet=true,areAllFieldsSet=true,lenient=true,zone=sun.util.calendar.ZoneInfo[id="Europe/Berlin",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Berlin,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]],firstDayOfWeek=2,minimalDaysInFirstWeek=4,ERA=0,YEAR=2,MONTH=11,WEEK_OF_YEAR=1,WEEK_OF_MONTH=5,DAY_OF_MONTH=31,DAY_OF_YEAR=365,DAY_OF_WEEK=4,DAY_OF_WEEK_IN_MONTH=5,AM_PM=1,HOUR=9,HOUR_OF_DAY=21,MINUTE=45,SECOND=0,MILLISECOND=0,ZONE_OFFSET=3600000,DST_OFFSET=0]
SQLTIME21:45:00
编辑:我通过使用字符串解决了这个问题......但是这个轴日期/时间对象对日光和时区不是很友好,DateTime 对象的麻烦甚至更糟(再次,我强制解决方案忽略 GMT/Daylights 和使用字符串)