Using the ThreeTen Android Backport library, what is the simplest way to convert a ZonedDateTime or OffsetDateTime into an old-school java.util.Date instance?
If I had full Java 8 libs at my disposal, this of course would be the way to do it (as in this question):
Date.from(zonedDateTime.toInstant());
But I cannot use that on Android; specifically Date.from(Instant instant) is missing.
See
DateTimeUtilswhich handles the methods added to classes likejava.util.Date: http://www.threeten.org/threetenbp/apidocs/org/threeten/bp/DateTimeUtils.htmlEdit: using that, the complete code would be: