我正在用 Java 创建一个记录器应用程序。我想根据当前时间设置文件名。在 android 应用程序中,我看到它像
import android.text.format.Time;
public CallRecorder(String filename,int sample_rate)
{
if (filename == null)
{
Time t = new Time();
t.setToNow();
filename = t.format2445(); // Create filename from current date.
}
在 java 中我应该使用什么包?或者怎么做?
最佳答案
Date
是一种可能性,尽管我会使用 currentTimeMillis()
.
关于java - 如何设置根据当前时间自动创建文件名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9248341/