Java Timestamp Format getFormattedTimestamp(@Nonnull Date date)

Here you can find the source of getFormattedTimestamp(@Nonnull Date date)

Description

get Formatted Timestamp

License

Open Source License

Declaration

@Nonnull
    public static String getFormattedTimestamp(@Nonnull Date date) 

Method Source Code

//package com.java2s;
/**//  w w w . j  av a  2s  .  c  o  m
 * Created by Adam Kobus on 24.05.2016.
 * Copyright (c) 2016 inFullMobile
 * License: MIT, file: /LICENSE
 */

import javax.annotation.Nonnull;
import java.text.SimpleDateFormat;
import java.util.Date;

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

    @Nonnull
    public static String getFormattedTimestamp(@Nonnull Date date) {
        synchronized (FORMAT_TIMESTAMP) {
            return FORMAT_TIMESTAMP.format(date);
        }
    }
}

Related

  1. getFormatForTimestamp( final Calendar now, final Calendar timestamp)
  2. getFormattedDate(String timestamp)
  3. getFormattedDateFromTimestamp(long timestamp)
  4. getFormattedTime(long timestamp, String format)
  5. getFormattedTimestamp()
  6. getFormattedTimestamp(File file)
  7. getFormattedTimeStamp(long timestamp, String formatString)
  8. getFullTimestampFormatter(Locale locale)
  9. getTimestamp(boolean useTwentyFourFormat)