Formatting date from a DatePicker
<p>I know I can get the date from a datepicker using the following methods:</p>

<ul>
<li>datepicker1.getDayOfMonth()</li>
<li>datepicker2.getMonth()</li>
<li>datepicker3.getYear()</li>
</ul>

<p>I am also getting the time from a timepicker using the following methods:</p>

<ul>
<li>timepicker1.getCurrentHour()</li>
<li>timepicker2.getCurrentMinute()</li>
</ul>

<p>I need to format this data into "yyyy-MM-dd HH:mm:ss" format to place it into an sqlite database as a DATETIME variable. Is there a method which can handle this?</p>

<p>I think I will have to build it manually like so:</p>

<pre><code>if(month &lt; 10){
    month = "0" + month;
}
if(day &lt; 10){
    day  = "0" + day ;
}
</code></pre>

<p>The problem was that the months and days were single digit.</p>
