【发布时间】:2017-04-19 18:34:05
【问题描述】:
private String getFilename() {
String filepath = Environment.getExternalStorageDirectory().getPath();
File file = new File(filepath, AUDIO_RECORDER_FOLDER);
if (!file.exists()) {
file.mkdirs();
}
return (file.getAbsolutePath() + "/" + System.currentTimeMillis() + file_exts[currentFormat]);
}
我想以当前日期和时间格式保存我的文件,因为我录制的文件没有以当前日期和时间格式保存。
【问题讨论】:
-
您已经成功保存了文件,但是文件名与您想要的不一样(当前日期和时间格式),对吧?
-
是的,我想用当前日期和时间格式保存我的文件。
-
使用
SimpleDateFormat。这里有一些例子stackoverflow.com/questions/6406470/java-simpledateformat
标签: android