How to get Date from a String in android?
<p>I want to get date from a give string. Suppose we have a string 09-Dec-2016 12:00:00 AM I want to display only 30-Dec-2016</p>

<pre><code>public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView textView=(TextView)findViewById(R.id.date);

       // String strCurrentDate = "Wed, 18 Apr 2012 07:55:29 +0000";
        String strCurrentDate = "30-Dec-2016 12:00:00 AM";
       // SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z");
        SimpleDateFormat format = new SimpleDateFormat("EEE, dd MMM yyyy hh:mm:ss Z");
        Date newDate = null;
        try {
            newDate = format.parse(strCurrentDate);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        format = new SimpleDateFormat("dd-MMM-yyyy hh:mm a");
        String date = format.format(newDate);
        textView.setText(date);


    }
</code></pre>

<p>I want to display date like this 30-Dec-2016</p>