List of usage examples for org.apache.commons.lang3.time DateUtils isSameDay
public static boolean isSameDay(final Calendar cal1, final Calendar cal2)
Checks if two calendar objects are on the same day ignoring time.
28 Mar 2002 13:45 and 28 Mar 2002 06:01 would return true.
From source file:ren.hankai.cordwood.jackson.DateDeserializerTest.java
@Test public void testDeserialize() throws Exception { final ObjectMapper om = new ObjectMapper(); final DateDeserializer des = new DateDeserializer(); final JsonParser jp = om.getFactory().createParser("{\"date\": \"2018-09-01\"}"); String val = null; do {//from w w w . java 2 s .c o m val = jp.nextTextValue(); } while (val == null); final Date date = des.deserialize(jp, om.getDeserializationContext()); final Date expDate = DateUtils.parseDate(jp.getText(), "yyyy-MM-dd"); Assert.assertTrue(DateUtils.isSameDay(date, expDate)); }
From source file:ren.hankai.cordwood.jackson.DateDeserializerTest.java
@Test public void testDeserializeWithCustomFormat() throws Exception { final ObjectMapper om = new ObjectMapper(); final DateDeserializer des = new DateDeserializer("yyyy|MM|dd"); final JsonParser jp = om.getFactory().createParser("{\"date\": \"2018|09|01\"}"); String val = null; do {/*from w ww . j av a2s. c om*/ val = jp.nextTextValue(); } while (val == null); final Date date = des.deserialize(jp, om.getDeserializationContext()); final Date expDate = DateUtils.parseDate(jp.getText(), "yyyy|MM|dd"); Assert.assertTrue(DateUtils.isSameDay(date, expDate)); }
From source file:ubic.gemma.core.analysis.preprocess.batcheffects.BatchInfoPopulationHelperServiceImpl.java
/** * @param earlierDate earlier date// w w w . ja va 2s . c o m * @param date data * @return false if 'date' is considered to be in the same batch as 'earlierDate', true if we should * treat it as a * separate batch. */ private boolean gapIsLarge(Date earlierDate, Date date) { return !DateUtils.isSameDay(date, earlierDate) && DateUtils .addHours(earlierDate, BatchInfoPopulationHelperServiceImpl.MAX_GAP_BETWEEN_SAMPLES_TO_BE_SAME_BATCH) .before(date); }