Java 如何在不改变日期的情况下将日期从getDateInstance转换为SimpleDateFormat?
我正试图为我的android应用程序找到合适的日期,但它似乎不起作用 当我使用这个代码时Java 如何在不改变日期的情况下将日期从getDateInstance转换为SimpleDateFormat?,java,android,date-formatting,Java,Android,Date Formatting,我正试图为我的android应用程序找到合适的日期,但它似乎不起作用 当我使用这个代码时 String currentDateTimeString = DateFormat.getDateInstance().format(new Date()); if(btn==v){ view.setText(currentDateTimeString); } 我得到的正确日期是2013年12月10日 但是当我尝试将日期转换为简单的日期格式时,程序总是停止工作 String currentDate
String currentDateTimeString = DateFormat.getDateInstance().format(new Date());
if(btn==v){
view.setText(currentDateTimeString);
}
我得到的正确日期是2013年12月10日
但是当我尝试将日期转换为简单的日期格式时,程序总是停止工作
String currentDateTimeString = DateFormat.getDateInstance().format(new Date());
SimpleDateFormat dateformat = new SimpleDateFormat("MM/FF");
String cdate = dateformat.format(currentDateTimeString);
if(btn==v){
view.setText(cdate);
}
同样,当我使用像这样的简单日期格式时,我得到了一个完全不同的日期,12/02
Calendar cdate = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("MM/FF");
if(btn==v){
view.setText(sdf.format(cdate.getTime()));
}
我正在尝试将当前日期显示为月/日,如有任何帮助,将不胜感激。FF是一周中的一天。请在每月的某一天尝试dd