Check If Date Is Within Supplied Range Using Joda Time

Supposed you need to know if certain date is within a given range of dates, here is how you do it using JodaTime:

//initialize a start & end time variable
DateTime start = new DateTime(1434931200000);
DateTime end = new DateTime(1435276800000);

//supply the start and end to an interval object
Interval interval = new Interval(start, end);

//this is the time that we need to check
DateTime timeToTest = new DateTime(1435046200000);

//now, check if the time is indeed within out specified start and end range
    System.out.println("Time is within range.");
} else {
    System.out.println("Time is outside the defined range.");    

Author: Arief Bayu Purwanto

Hello, my name is Arief Bayu Purwanto, a 24 years old father of a beautiful daughter. Interested in online programming, linux, games, and reading. Currently working on as junior developer. I live in a relatively quite and cool place called Malang. I'm available for some freelance stuff as well as some consulting job. You can see my portofolio for some previous task I've finished and some other information related to my capability. Btw, I'm plurking here.