Java Date Format Pattern getFormat(long stamp)

Here you can find the source of getFormat(long stamp)

Description

get Format

License

Open Source License

Declaration

public static String getFormat(long stamp) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

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

public class Main {
    /**//  w  ww  .ja  v  a2 s. c  om
     * Get the dateFormat from given timestamp in milliseconds and the pattern
     *
     * @param stamp   The timestamp (System.currentTimeMillis())
     * @param pattern The pattern (e.g.: 'dd.MM.yyyy HH:mm:ss.SSS')
     * @return The format as string
     */
    public static String getFormat(long stamp, String pattern) {
        return new SimpleDateFormat(pattern).format(new Date(stamp));
    }

    public static String getFormat(long stamp) {
        return getFormat(stamp, "dd.MM.yyyy HH:mm:ss.SSS");
    }
}

Related

  1. getDBFormat()
  2. getExcelFormat()
  3. getFolderFormat()
  4. getFormat()
  5. getFormat()
  6. getFormat(long stamp, String pattern)
  7. getFormat(String format)
  8. getFormat(String formatPattern)
  9. getFormat(String formatString)