[threeten-dev] Calendar.toZonedDateTime?

Stephen Colebourne scolebourne at joda.org
Wed Jun 26 12:43:14 PDT 2013


Its a little hard for me to tell what current methods we have.

We seem to have
Calendar.toInstant()
GregCal.toZDT()
GregCal.from(ZDT)

I'm surprised I couldn't see a Calendar.from() method.
Calendar.from(ChronoZonedDateTime) would make most sense

And as suggested,
Calendar.toZonedDateTime() returning ChronoZonedDateTime
(using covariant return types in GregCal to return ZonedDateTime)
It would have to handle chronology to calendar class mapping.

In addition, the Calendar.Builder should have a setInstant(Instant)
method, as it looks odd to have two setInstant() methods, neither of
which actually take an Instant!

Stephen


On 26 June 2013 20:05, roger riggs <roger.riggs at oracle.com> wrote:
> Should it be possible to convert any java.util.Calendar object to a
> ZonedDateTime?
> The conversion works from an Instant and a TimeZone both found in Calendar.
>
> The current placement of toZonedDateTime in GregorianCalendar does not allow
> it to be used with some calendars, for example a Japanese Imperial Calendar
> is not of type GregorianCalendar.
>
> Could toZonedDateTime be moved up the Calendar?
>
> Roger
>
>


More information about the threeten-dev mailing list