Java Timestamp Create createTimeStamp()

Here you can find the source of createTimeStamp()

Description

Creates a timestamp string

License

Open Source License

Return

A string containing a timestamp

Declaration

public static String createTimeStamp() 

Method Source Code

//package com.java2s;
/*//  w w w .  j  a va2 s .  co m
 * Copyright (C) 2011 Sony Ericsson Mobile Communications AB
 * Copyright (C) 2012-2013 Sony Mobile Communications AB
 *
 * This file is part of ChkBugReport.
 *
 * ChkBugReport 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 2 of the License, or
 * (at your option) any later version.
 *
 * ChkBugReport 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 ChkBugReport.  If not, see <http://www.gnu.org/licenses/>.
 */

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    /**
     * Creates a timestamp string
     * @return A string containing a timestamp
     */
    public static String createTimeStamp() {
        SimpleDateFormat fmt = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss");
        Date date = new Date(System.currentTimeMillis());
        return fmt.format(date);
    }
}

Related

  1. createEtag(String cookieId, Date timestamp)
  2. createTimestamp()
  3. createTimeStamp()
  4. createTimeStamp()
  5. createTimestamp(final int aYear, final int aMonth, final int aDate, final int aHour, final int aMinute, final int aSecond)
  6. createTimestamp(final int year, final int month, final int day, final int hour, final int minute, final int second)