按格式取系统日期


// 按格式取系统日期
public static String getDateWithYMD() {
Calendar now = Calendar.getInstance();
int month = now.get(Calendar.MONTH) + 1;
int day = now.get(Calendar.DAY_OF_MONTH);
int year = now.get(Calendar.YEAR);
String date = year + "-" + month + "-" + day;
return date;
}
posted @ 2017-08-07 14:57  ameizai  阅读(151)  评论(0)    收藏  举报