// date format
SimpleDateFormat convert=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String now = convert.format(Calendar.getInstance().getTime());
Date date=convert.parse(now);
//compareto two date
// create two dates
Date date = new Date(99,4,24);
Date date2 = new Date(102,2,13);
//three condition
int comparison = date.compareTo(date2); // = -1
int comparison2 = date2.compareTo(date);// =1
int comparison3 = date.compareTo(date); //= 0
全站熱搜
留言列表