Java Now nowStr()

Here you can find the source of nowStr()

Description

Return a string representing the current time.

License

Open Source License

Declaration

public static String nowStr() 

Method Source Code

//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());
    }
}

Related

  1. nowFile()
  2. nowFormat(String format)
  3. nowFormat(String format)
  4. nowIdentity()
  5. nowInBasicFormat()
  6. nowString(String pattern)
  7. nowString(String pattern)
  8. nowTime(String formartStr)
  9. nowTime(String format)