Java Date Now getCurrentTimestampString()

Here you can find the source of getCurrentTimestampString()

Description

Gets the current date and time in a readable format for logging.

License

Apache License

Return

The formatted date time string

Declaration

public static String getCurrentTimestampString() 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    private static final SimpleDateFormat SIMPLE_DATE_FORMATTER1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z");

    /**// ww w . j a  v  a2  s .  c  om
     * Gets the current date and time in a readable format for logging.
     *
     * @return The formatted date time string
     */
    public static String getCurrentTimestampString() {
        return SIMPLE_DATE_FORMATTER1.format(new Date());
    }
}

Related

  1. getCurrentTimestamp()
  2. getCurrentTimestamp()
  3. getCurrentTimeStamp()
  4. getCurrentTimestamp()
  5. getCurrentTimestampAsISOString()
  6. getCurrentTimeStr()
  7. getCurrentTimeStr()
  8. getCurrentTimeString(String format)
  9. getCurrentTimeString(String pattern)