public void onClick(View v){
switch(v.getId()){
case R.id.button1:
//需要日期,將現在的時間格式化爲日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String showDate = sdf.format(new Date());
et01.setText(showDate);
break;
case R.id.button2:
SimpleDateFormat sdf2 = new SimpleDateFormat("HH:mm:SS");
String showDate2 = sdf2.format(new Date());
et01.setText(showDate2);
break;
default:
break;
}
}