Here you can find the source of getFormat(long stamp, String pattern)
Parameter | Description |
---|---|
stamp | The timestamp (System.currentTimeMillis()) |
pattern | The pattern (e.g.: 'dd.MM.yyyy HH:mm:ss.SSS') |
public static String getFormat(long stamp, String pattern)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { /**//from ww w. j av a2 s. com * 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"); } }