abhay sachu abhay sachu - 5 months ago 14x
Java Question

Giving current timestamp as folder name in java

As we can give the current time as file name in java , can we do the same with folders too?
Can we give the name of the folder as current time stamp?
please help.Thank You.


yes something like this.

Date now = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("hh mm ss");
String time = dateFormat.format(now);
File dir = new File(time);