Reputation: 2800
I am creating a recorder application in java. I want to set the file names according to the current time. In an android application I have seen it like
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.
}
In java what package should I use? or how to do that?
Upvotes: 2
Views: 795
Reputation: 168825
Date
is one possiblility, though I'd use the currentTimeMillis()
.
Upvotes: 1