SimpleDateFormat dateformate = new SimpleDateFormat("dd-MMM-yyyy");
Calendar currentDate = Calendar.getInstance();
String currentDateStr = dateformate.format(currentDate.getTime());
Log.i("Infoe ", " " + currentDateStr.toString());
System.out.println("Current date is : " + currentDateStr);
////=== OR
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
sdf.applyPattern("dd-MMM-yyyy");
Date x = new Date(currentDate.get(Calendar.YEAR) - 1900,
currentDate.get(Calendar.MONTH), currentDate.get(Calendar.DAY_OF_MONTH));
Log.i("Infoe ", " " + sdf.format(x));
System.out.println(sdf.format(x));
它的 3912 bcz ...日期设置为... Calendar.set(year + 1900, month, date) 或 GregorianCalendar(year + 1900, month, date)。根据公历
我认为日历的使用是 gd,因为不推荐使用日期...对于日期格式,请使用 dd-MMM-yyyy no dd-MM-yyyy bcz 您想要月份前 2 个字符...
对于日期格式