I Want to convert a date from the format"dd-mmm-yyyy" to "yyyy-mm-dd". And here is my code.
public void convertDate(){
GregorianCalendar todaysDate = (GregorianCalendar) month.clone(); // Its show the error over here.
SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy", Locale.US);
currentdatestring = df.format(todaysDate.getTime());
try{
Date tdate3= df.parse(currentdatestring);
tdate4=targetDateformat.format(tdate3);
}
catch (ParseException e) {
Log.e(getPackageName(), e.getMessage());
e.printStackTrace();
}
But the problem is it showing a nullpointer exception . And i am not able to understand the mistake. Please if someone can help ?