HRJ
HRJ

Reputation: 17797

How to convert an epoch date to joda times LocalDate?

I can see how to convert from LocalDate to epoch date, but how do I go the other way around?

That is, if I have the number of days from epoch, how can I construct org.joda.time.LocalDate ?

Upvotes: 0

Views: 2500

Answers (2)

Construct a new java.util.Date and then pass it to the LocalDate Constructor

Upvotes: 1

Jon Skeet
Jon Skeet

Reputation: 1503140

Simple:

// You'd probably make this a constant somewhere
LocalDate epoch = new LocalDate(1970, 1, 1);
LocalDate desiredDate = epoch.plusDays(daysSinceEpoch);

Upvotes: 3

Related Questions