日期转字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date dates = new Date();
String strTime = sdf.format(dates);
EditText editDate = findViewById(R.id.editText6);
editDate.setText(strTime);
字符串转日期
⌚Time: 2022-10-31 17:32:41
日期转字符串
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
Date dates = new Date();
String strTime = sdf.format(dates);
EditText editDate = findViewById(R.id.editText6);
editDate.setText(strTime);
字符串转日期