我想以两位数的格式显示日期,我希望它是这样的:当月或日是一个单一的数字时,4会显示为04。如何实现呢?
Calendar c = Calendar.getInstance(); int year = c.get(Calendar.YEAR); int day = c.get(Calendar.DAY_OF_MONTH); int month = c.get(Calendar.MONTH); if (month % 10 == 0) { Place = 0 + month; } String Dates = year + "-" + Place + "-" + day; Date.setText((Dates));
三国纷争
富国沪深
相关分类