/** * Get the Julian instant: a decimal value whose integer part is the Julian day number multiplied * by the number of seconds per day, and whose fractional part is the fraction of the second. This * method operates on the local time, ignoring the timezone. The caller should call normalize() * before calling this method to get a normalized time. * * @return the Julian instant corresponding to this xs:dateTime value */ public BigDecimal toJulianInstant() { int julianDay = DateValue.getJulianDayNumber(year, month, day); long julianSecond = julianDay * (24L * 60L * 60L); julianSecond += (((hour * 60L + minute) * 60L) + second); BigDecimal j = BigDecimal.valueOf(julianSecond); if (microsecond == 0) { return j; } else { return j.add( BigDecimal.valueOf(microsecond) .divide(DecimalValue.BIG_DECIMAL_ONE_MILLION, 6, BigDecimal.ROUND_HALF_EVEN)); } }