@Testpublic void testTimestamp(){ Date time = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(time); calendar.add(Calendar.HOUR,-1); Date startTime = calendar.getTime(); calendar.add(Calendar.HOUR,2); Date endTime = calendar.getTime(); System.out.println(time); System.out.println(startTime); System.out.println(endTime);long timestamp = time.getTime();long startTimestamp = startTime.getTime();long endTimestamp = endTime.getTime(); System.out.println(timestamp); System.out.println(startTimestamp); System.out.println(endTimestamp); System.out.println(timestamp>startTimestamp); System.out.println(timestamp>endTimestamp); }