日付を「dd-mmm-yyyy」形式から「yyyy-mm-dd」形式に変換したい。そして、ここに私のコードがあります。
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();
}
しかし問題は、nullpointer 例外が表示されることです。そして、私は間違いを理解することができません。誰か助けてください。