Пример #1
0
  @Test
  public void testTimestampToJavaOrUnix() {
    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    long javaTime = System.currentTimeMillis();
    cal.setTimeInMillis(javaTime);

    long julianTimestamp = DateTimeUtil.javaTimeToJulianTime(cal.getTimeInMillis());

    assertEquals(javaTime, DateTimeUtil.julianTimeToJavaTime(julianTimestamp));
    assertEquals(javaTime / 1000, DateTimeUtil.julianTimeToEpoch(julianTimestamp));
  }
Пример #2
0
 public static TimestampDatum createTimestampDatumWithJavaMillis(long millis) {
   return new TimestampDatum(DateTimeUtil.javaTimeToJulianTime(millis));
 }