serge
serge

Reputation: 1609

Print Joda-Time Interval

Does anybody know how to print a readable Joda-Time Interval? I tried to search for it but all I find is how to print periods. But I really need Interval.

I construct it something like this:

Interval interval = new Interval(bDT, eDT);

Upvotes: 0

Views: 598

Answers (1)

Jon Skeet
Jon Skeet

Reputation: 1502286

Just call toString() - Interval (or rather AbstractInterval) overrides toString with a readable format. For example:

Instant start = new Instant(0L);
Instant end = new Instant(1390596587000L);
Interval interval = new Interval(start, end);
System.out.println(interval); // Implicitly calls toString()

Output (on my box):

1970-01-01T00:00:00.000Z/2014-01-24T20:49:47.000Z

Upvotes: 3

Related Questions