Java Timestamp Create getTimestamp()

Here you can find the source of getTimestamp()

Description

Get the current human readable timestamp.

License

Open Source License

Return

The string representation of the timestamp.

Declaration

public static String getTimestamp() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2014//w w  w  .java  2 s  .c  o  m
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Benjamin Klatt - initial API and implementation and/or initial documentation
 *******************************************************************************/

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Main {
    /**
     * Get the current human readable timestamp. For example, to be used in
     * logging.
     * 
     * @return The string representation of the timestamp.
     */
    public static String getTimestamp() {

        /** The date format to use in job logging etc. */
        DateFormat dateFormat = new SimpleDateFormat("yyyy.MM.dd hh:mm:ss:S");

        return (dateFormat.format(new Date()));
    }
}

Related

  1. getTimeStamp()
  2. getTimestamp()
  3. getTimeStamp()
  4. getTimestamp()
  5. getTimeStamp()
  6. getTimeStamp()
  7. getTimestamp()
  8. getTimeStamp()
  9. getTimeStamp()