title: converting a calendar object into a string in java with format "yyyy-mm-dd hh:mm:ss"
body: <p>I'm converting a date stored in a calendar object in a string for a query in MySQL. I need the string in format "yyyy-MM-dd HH:mm:ss", i.e.: "2010-01-01 15:30:00".
  I'm using a code like:</p>
  
  <pre><code>    Calendar TimeStop = Calendar.getInstance();
      TimeStop.set(2010, 01, 01, 15, 30, 0);
      SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      String TimeStop_Str = sdf.format(TimeStop.getTime());
  </code></pre>
  
  <p>now, the string, instead of being "2010-<strong>01</strong>-01 15:30:00" like I would expect is "2010-<strong>02</strong>-01 15:30:00".
  I have already checked on <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html" rel="noreferrer">http://download.oracle.com/javase/1.4.2/docs/api/java/text/SimpleDateFormat.html</a> for possible errors in the parser formula (for example the capital MM for month or capital HH for hours) but it didn't worked.</p>
  
  <p>I guess that there is some other field that I should set, or maybe there is another method... any idea?</p>