Java: Easiest way to convert Calendar to String and back
<p>My application uses an API that accepts only a <code>Map&lt;String, String&gt;</code>. Therefore, all objects must be converted to this form before they can be passed to the API.</p>

<p>This is quite trivial for simple classes like <code>Boolean, BigDecimal</code> etc. But it is proving somewhat problematic for converting a <code>Calendar</code> object.</p>

<p>I am not overly familiar with all the nuances of Calendars/Dates etc in Java so would appreciate some advice on converting my Calendar to a String and then back again.</p>

<p>When my application receives a request, it already has the Calendar constructed. It must then convert this to a String (1), pass it through the API (2), and then convert it back to a Calendar (3) on the other side.</p>

<p>So I am in control of 1 and 3, but not 2.</p>

<p>Based on this, what is the easiest way to convert to and then from a String?</p>

<p>Thanks</p>
