ISODate implements Cloneable, Comparable<ISODate>, Serializable, XmlEmbeddable { public long timeDifferenceInSeconds(ISODate date) { return getTimeInSeconds() - date.getTimeInSeconds(); } ISODate();  ISODate(final long time, final boolean shortDate);  ISODate(final long time);  ISODate(@Nonnull final String isoDate); static String parseISODateTime(final String stringToParse); static String parseISODateTimes(String input1, String input2); static DateTime parseBasicOrFullDateTime(String input1); ISODate clone(); long timeDifferenceInSeconds(ISODate date); @Transient String getDateAsString(); String toString(); Date toDate(); @Transient long getTimeInSeconds(); @XmlValue String getDateAndTime(); void setDateAndTime(String isoDate); @Transient boolean isDateOnly(); @Transient boolean isDateYearOnly(); @Transient boolean isDateYearMonthOnly(); @Transient int getYears(); @Transient int getDays(); @Transient int getMonths(); @Transient int getHours(); @Transient int getMinutes(); @Transient int getSeconds(); @Override int hashCode(); @Override boolean equals(Object obj); @Transient String getTimeAsString(); @Override int compareTo(ISODate o); @Override void addToXml(Element element);  }
@Test public void testTimeDifferenceInSeconds() { ISODate date1 = new ISODate("1976-6-3T1:2:3"); ISODate date2 = new ISODate("1976-6-3T1:2:30"); assertEquals(27, date2.timeDifferenceInSeconds(date1)); assertEquals(-27, date1.timeDifferenceInSeconds(date2)); }
@Test public void testSub() throws Exception { ISODate isoDate1 = new ISODate("2013-10-10T13:20:40Z"); ISODate isoDate2 = new ISODate("2013-10-10T13:21:40Z"); assertEquals(60, isoDate2.timeDifferenceInSeconds(isoDate1)); isoDate2 = new ISODate("2013-10-10T13:19:40Z"); org.junit.Assert.assertEquals(-60, isoDate2.timeDifferenceInSeconds(isoDate1)); }