JodaTime Interval

Overview

An
Interval
represents the period of time between two
Instant
s.

Refer to
Interval
on Joda-Time site for further details.

  1. Construct An Interval
  2. Find Relationship Between Two Intervals (Gap, Adjoining, Overlap)
  3. Modify Interval Using Millis, Duration and Instant

Construct An Interval

Interval can be constructed in the following six ways:

  • Using start and end milliseconds
  • Using Duration and Start/End Instant
  • Using another Interval
  • Using Start and End Instants
  • Using Period and Start/End Instant
  • Using String Representation


Find Relationship Between Two Intervals (Gap, Adjoining, Overlap)

The following relationships can exist between two intervals:

  • Adjoining (a.k.a abut): Are the two intervals adjoing to each other
  • Gap: Do the two intervals have gap between them
  • Overlap: Do the two intervals overlap each other


Modify Interval Using Millis, Duration and Instant

An
Interval
can be modified in the following ways:

  • Modifying start and end using millis
  • Modifying start and end using Duration
  • Modifying start and end using Instant


To start, click on the next arrow. If you find anything missing in the tutorials then please drop in your comments.

Leave a Comment