public boolean intersects(CalendarDate start, CalendarDate end) { if (startDt.isAfter(end.getDateTime())) return false; if (endDt.isBefore(start.getDateTime())) return false; return true; }
public boolean intersects(CalendarDate start, CalendarDate end) { if (startDt.isAfter(end.getDateTime())) return false; if (endDt.isBefore(start.getDateTime())) return false; return true; }
public boolean intersects(CalendarDate start, CalendarDate end) { if (startDt.isAfter(end.getDateTime())) return false; if (endDt.isBefore(start.getDateTime())) return false; return true; }
/** * udunits formatting * @param cd the calendar date * @return udunits formated date */ static public String toTimeUnits(CalendarDate cd){ return df_units.print(cd.getDateTime()); }
static public String toDateTimeString(CalendarDate cd) { if(cd.getDateTime().getMillisOfSecond()==0) return dtf.print(cd.getDateTime()); else return dtf_with_millis_of_second.print(cd.getDateTime()); }
static public String toDateTimeStringISO(CalendarDate cd) { if(cd.getDateTime().getMillisOfSecond() == 0) return isof.print( cd.getDateTime() ); else return isof_with_millis_of_second.print(cd.getDateTime()); }
public boolean includes(CalendarDate cd) { DateTime dt = cd.getDateTime(); if (startDt.isAfter(dt)) return false; if (endDt.isBefore(dt)) return false; return true; }
public boolean includes(CalendarDate cd) { DateTime dt = cd.getDateTime(); if (startDt.isAfter(dt)) return false; if (endDt.isBefore(dt)) return false; return true; }
static public String toDateTimeString(CalendarDate cd) { if(cd.getDateTime().getMillisOfSecond()==0) return dtf.print(cd.getDateTime()); else return dtf_with_millis_of_second.print(cd.getDateTime()); }
public CalendarDateRange(CalendarDate start, long durationInSecs) { this.start = start; this.end = start.add((int) durationInSecs, CalendarPeriod.Field.Second ); this.startDt = start.getDateTime(); this.endDt = end.getDateTime(); this.cal = start.getCalendar(); }
public CalendarDateRange(CalendarDate start, long durationInSecs) { this.start = start; this.end = start.add((int) durationInSecs, CalendarPeriod.Field.Second ); this.startDt = start.getDateTime(); this.endDt = end.getDateTime(); this.cal = start.getCalendar(); }
private CalendarDateRange(CalendarDate start, CalendarDate end) { this.start = start; this.end = end; this.startDt = start.getDateTime(); this.endDt = end.getDateTime(); this.cal = start.getCalendar(); assert this.cal.equals(end.getCalendar()); }
private CalendarDateRange(CalendarDate start, CalendarDate end) { this.start = start; this.end = end; this.startDt = start.getDateTime(); this.endDt = end.getDateTime(); this.cal = start.getCalendar(); assert this.cal.equals(end.getCalendar()); }
public CalendarDateRange extend(CalendarDateRange other) { DateTime cs = other.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? startDt : cs; // earlier one DateTime ce = other.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? ce : endDt; // later one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange intersect(CalendarDateRange clip) { DateTime cs = clip.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? cs : startDt; // later one DateTime ce = clip.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? endDt : ce; // earlier one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange intersect(CalendarDateRange clip) { DateTime cs = clip.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? cs : startDt; // later one DateTime ce = clip.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? endDt : ce; // earlier one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange extend(CalendarDateRange other) { DateTime cs = other.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? startDt : cs; // earlier one DateTime ce = other.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? ce : endDt; // later one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange intersect(CalendarDateRange clip) { DateTime cs = clip.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? cs : startDt; // later one DateTime ce = clip.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? endDt : ce; // earlier one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
public CalendarDateRange extend(CalendarDateRange other) { DateTime cs = other.getStart().getDateTime(); DateTime s = startDt.isBefore(cs) ? startDt : cs; // earlier one DateTime ce = other.getEnd().getDateTime(); DateTime e = endDt.isBefore(ce) ? ce : endDt; // later one return CalendarDateRange.of(CalendarDate.of(cal, s), CalendarDate.of(cal, e)); }
@Test public void testCalendarToDate() { CalendarDate cdate = CalendarDateFormatter.isoStringToCalendarDate(Calendar.uniform30day, "1968-01-30T15:00:00.000Z"); System.out.printf("%s%n", cdate); System.out.printf("%s%n", cdate.getDateTime()); System.out.printf("%s%n", cdate.toDate()); System.out.printf("%s%n", CalendarDateFormatter.toDateTimeStringISO(cdate.toDate())); System.out.printf("%s%n", CalendarDateFormatter.toDateString(cdate)); CalendarDateFormatter cdf = new CalendarDateFormatter("yyyyMMdd"); System.out.printf("%s%n", cdf.toString(cdate)); }