title: How to parse String to Date using FastDateFormat in a specified format
body: <p>Problem:</p>
  
  <p>I need to add specified number of Days in a given Date.
  The function should return Date class Object and should use FastDateFormat.</p>
  
  <p>Solution:</p>
  
  <p>I wrote the Code but I need the Output in yyyy-MM-dd HH:mm:ss.</p>
  
  <p>When I pass Input to this function </p>
  
  <pre><code> public static void main(String[] args) throws ParseException {
      String dateFormat="yyyy-MM-dd HH:mm:ss";
          String s2=addDate(dateFormat);
          convertStringToDate(s2,dateFormat);
  
      }
      public static Date convertStringToDate(String dateInStr, String dateFormat) throws ParseException
      {
          FastDateFormat fdf=FastDateFormat.getInstance(dateFormat);//("yyyy-MM-dd HH:mm:ss");
          Date date = null;
          date = fdf.parse(dateInStr);
          System.out.println("From convertStringToDate ");
          System.out.println(date);
          return date;
      }
  public static String addDate(String dateFormat) throws ParseException{
              FastDateFormat fdf=FastDateFormat.getInstance(dateFormat);
              Calendar c = Calendar.getInstance();    
              c.add(Calendar.DATE,1);
              String s1=fdf.format(c.getTime());
              System.out.println("From addDate ");
              System.out.println(s1);
              return s1;
          }
  </code></pre>
  
  <p>Expected Output from convertStringToDate:</p>
  
  <p>2017-04-21 17:01:31</p>
  
  <p>OutputShown from convertStringToDate:</p>
  
  <pre><code>Fri Apr 21 17:01:31 IST 2017
  </code></pre>
  
  <blockquote>
    <p>Can anyone guide me how should I solve the above problem?</p>
  </blockquote>