@Test
public void testGetDateAndTime() {

    Calendar cal = Calendar.getInstance();
    cal.set(Calendar.YEAR, 1990);
    cal.set(Calendar.MONTH, 11);
    cal.set(Calendar.DAY_OF_MONTH, 5);
    cal.set(Calendar.HOUR_OF_DAY, 23);
    cal.set(Calendar.MINUTE, 2);
    cal.set(Calendar.SECOND, 3);
    ISODate date = new ISODate(cal.getTimeInMillis(), false);
    assertEquals("1990-12-05T23:02:03", date.getDateAndTime());
    assertEquals("1990-12-05", date.getDateAsString());
    date = new ISODate(cal.getTimeInMillis(), true);
    assertEquals("1990-12-05", date.getDateAndTime());
    assertEquals("1990-12-05", date.getDateAsString());
}