abhay sachu abhay sachu - 2 years ago 110
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);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download