abhay sachu abhay sachu - 1 year ago 56
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.

Answer Source

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);
dir.mkdir();