android之获取系统时间并作为文件名

SimpleDateFormat timesdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//SimpleDateFormat filesdf = new SimpleDateFormat("yyyy-MM-dd HHmmss"); //文件名不能有:
String FileTime =timesdf.format(new Date()).toString();//获取系统时间
String filename = FileTime.replace(":", "");
MyTextView.setText("Time = "+FileTime+"\nfile"+filename);

你可能感兴趣的:(android)