Date
Date date = new Date();
格式化DateFormat->SimpleDateFormat
String format = "d";//不带前导零的日期,dd带前导零(03)
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
String str = dateFormat.format(date);//str为当前的日期,比如3
String format = "M-d";//MM带前导零(04)
SimpleDateFormat dateFormat = new SimpleDateFormat(format);
String str = dateFormat.format(date);//str为4-3
//yy为两位年份,yyyy为四位,h,m,s分别为时,分,秒,如果h为2,则H为14,t显示早上或下午
Calender
Calender calender = Calender.getInstance();
calender.(get(Calender.YEAR));//MONTH月份需要加一,DATE,HOUR,MINUTE,SECOND