Reputation: 9571
How does one convert a ReadableInstant (in Joda Time) to a java.util.Date ? ReadableInstant doesn't seem to have any methods that allow one to convert to a Date.
Upvotes: 4
Views: 1363
Reputation: 1135
You can also use like this.
ReadableInstant instant;
Date date = DateTime.toDateTime(instant.getChronology()).toDate();
But performance wise not so good
Upvotes: 2
Reputation: 9571
OK, this is a bit simpler than I thought. ReadableInstant does provide a getMillis() function that returns the epoch time as a Long, so we can use that to convert to a Date.
ReadableInstant instant;
Date date = new Date(instant.getMillis());
Upvotes: 3