Converting LocalDate to GregorianCalendar in Java
<p>I want to convert <code>LocalDate</code> to <code>GregorianCalendar</code>. Please advice.</p>

<p>In my application we are using <code>GregorianCalendar</code> to work with date's. But I got a Joda <code>LocalDate</code> as a return type when I called one of the webservice.
Now I want to convert that <code>LocalDate</code> to <code>GregorianCalendar</code> as it's differing with the month value display. Please see the sample code below.</p>

<p><code>LocalDate</code> displays 10 for the month October whereas <code>GregorianCalendar</code> display 9 for the month October as it starts from index 0. Please suggest how to convert <code>LocalDate</code> to <code>GregorianCalendar</code>, I tried to see API methods but with no luck.</p>

<pre><code>import java.util.GregorianCalendar;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;

// Sample code below
LocalDate localDateObj = new LocalDate();
System.out.println("Month value using LocalDate :" + localDateObj.getMonthOfYear());
System.out.println("Date using LocalDate : " + localDateObj);

// Converting LocalDate to DateTime
DateTime dateTimeObj = localDateObj.toDateTimeAtStartOfDay();
System.out.println("DateTime month " + dateTimeObj.getMonthOfYear());
System.out.println("Date using DateTime : " + dateTimeObj);

// GregorianCalendar
GregorianCalendar gc = new GregorianCalendar();
System.out.println("Month value using GregorianCalendar:" + gc.OCTOBER);
System.out.println("GC :" + gc.getTime());
</code></pre>

<h3>Output:</h3>

<blockquote>
<pre><code>Month value using LocalDate :10
Date using LocalDate : 2016-10-13
DateTime month 10
Date using DateTime : 2016-10-13T00:00:00.000-04:00
Month value using GregorianCalendar:9
GC :Thu Oct 13 16:14:43 EDT 2016
</code></pre>
</blockquote>