Code example for Timestamp

Methods: getTimetoString

0
        cal2.set(Calendar.MINUTE, 28);
        cal2.set(Calendar.SECOND, 02);
        cal2.set(Calendar.MILLISECOND, 0);
 
        long millis = cal2.getTime().getTime();
        Timestamp t2 = new Timestamp(millis);
        times.add(t2);
        // 
         Calendar cal3 = new GregorianCalendar();
          cal3.set(Calendar.YEAR, 1221);
          cal3.set(Calendar.MONTH, Calendar.SEPTEMBER);
          cal3.set(Calendar.DATE, 22);
         cal3.set(Calendar.HOUR_OF_DAY, 10);
         cal3.set(Calendar.MINUTE, 11);
         cal3.set(Calendar.SECOND, 55);
         cal3.set(Calendar.MILLISECOND, 0);
 
         millis = cal3.getTime().getTime();
         Timestamp t3 = new Timestamp(millis);
         times.add(t3);
 
        String col = it.next();
 
        Timestamp timeRes = res.getTimestamp(col);
        assertEquals(t2.toString(), timeRes.toString());
        assertEquals(t2.toString(), timeRes.toString());
        assertEquals(t2.getTime(), timeRes.getTime());
        assertEquals(t2, timeRes);
        // DATE value 
        col = it.next();
 
        timeRes = res.getTimestamp(col);
        assertEquals(t3.toString(), timeRes.toString());
Contextual code suggestions in your IDE  Get Codota for Java