Android get date and insert to filename
You can use this:
import java.text.SimpleDateFormat;
// ...
SimpleDateFormat formatter = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.US);
Date now = new Date();
String fileName = formatter.format(now) + ".tar.gz";
Also you must be getting an error somewhere, that would help a lot to find the problem. Make sure you don't have empty catch
blocks :
catch (Exception e) {}