I have a method getCalendarFromClass that returns me an object of Calendar.
And I am converting it into LocalDate of Joda Time API using fromCalendarFields method.
LocalDate.fromCalendarFields(a.getCalendarFromClass());
But how can specify the TimeZone when performing this conversion as I didn’t found it in javadoc.
The javadoc for fromCalendarFields method mentions :
Each field is queried from the Calendar and assigned to the LocalDate. This is useful if you have been using the Calendar as a local date, ignoring the zone.
The
Calendarhas a time zone, and that will be used (by theCalendar) when Joda Time requests the different field values. Joda Time just usescalendar.get(Calendar.YEAR)etc.The returned
LocalDatedoesn’t have a time zone, conceptually.