Java tutorial
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Hoang Nguyen. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Public License v2.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * Hoang Nguyen - initial API and implementation ******************************************************************************/ import java.text.SimpleDateFormat; import java.util.Calendar; import android.os.Environment; public class Main { static String GenerateFilename() { String logfile = Environment.getExternalStorageDirectory().getPath() + "/screenstandby" + getDateTime() + ".backup-ss"; return logfile; } final static String getDateTime() { SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd-hhmmss"); return df.format(Calendar.getInstance().getTime()); } }