title: How can i get current date and time in android and store it into string
body: <p>Currently i am using the code below: </p>
  
  <pre><code>String  currentDateTimeString = DateFormat.getDateTimeInstance()
                          .format(new Date());
  </code></pre>
  
  <p>From this i am getting the output in the following format - </p>
  
  <p><code>Jun 5, 2015 1:15:29 PM</code></p>
  
  <p>But now i want the output in the format below- </p>
  
  <pre><code>2015-06-05 08:10:40 
  </code></pre>
  
  <p>It can be in 12 or 24 hour format. </p>
  
  <p>I want current date time with above datetime format.</p>
  
  <p>I have already use SimpleDateFormat but i am not able to get the above
  date time format with current date and time</p>
  
  <p>So, how can i achieve this?</p>