Here you can find the source of nowStr()
public static String nowStr()
//package com.java2s; /* // ww w. java 2 s . c om Copyright: (c) 2006-2012 Sean Hammond <seanhammond@lavabit.com> This file is part of Storymaps. Storymaps is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Storymaps is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Storymaps. If not, see <http://www.gnu.org/licenses/>. */ import java.text.SimpleDateFormat; import java.util.Date; public class Main { /** * Return a string representing the current time. */ public static String nowStr() { SimpleDateFormat format = new SimpleDateFormat( "yyyy-MM-dd-HH-mm-ss"); return format.format(new Date()); } }