title: Obtaining String in the format of DD-MON-YY from date
body: <p>I have the following code generating a random date, but I don't know how to display it in the form of <code>DD-MON-YY</code> (for example <code>12-NOV-12</code>), which happens to be the SQL standard format for dates (i.e. in the end I plan on passing this data with JDBC into an oracle database).</p>
  
  <pre><code>GregorianCalendar gc = new GregorianCalendar();
  
  gc.set(gc.YEAR,  randBetween(1900, 2015)); //randBetween creates a random number between the two
  
  gc.set(gc.DAY_OF_YEAR, randBetween(1, gc.getActualMaximum(gc.DAY_OF_YEAR)));
  
  //Mysterious formatting needed here
  
  String s = //date would go here in the DD-MON-YY format
  </code></pre>
  
  <p>Anyway, point being I have tried many ways to format it and the closest I've got it to has been <code>DD-MM-YY</code> (for example <code>12-12-12</code>). I was wondering if anyone knew of a short/easy way to achieve my goal without resorting to the primitive long way (if/switch-case statements).</p>