Java Millisecond Format format(long millis)

Here you can find the source of format(long millis)

Description

Format the millisecond timestamp to a human-readable timestamp.

License

Open Source License

Parameter

Parameter Description
millis The timestamp.

Return

A human-readable timestamp in the default format used in Maunium products.

Declaration

public static String format(long millis) 

Method Source Code


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

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

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

    /**// w w  w .  j  ava  2  s  .  c o  m
     * Format the millisecond timestamp to a human-readable timestamp.
     * 
     * @param millis The timestamp.
     * @return A human-readable timestamp in the default format used in Maunium products.
     */
    public static String format(long millis) {
        return def.format(new Date(millis));
    }

    /**
     * Format the Date timestamp to a human-readable timestamp.
     * 
     * @param d The timestamp.
     * @return A human-readable timestamp in the default format used in Maunium products.
     */
    public static String format(Date d) {
        return def.format(d);
    }
}

Related

  1. createDateTimeString(final long ms, final DateFormat timeFormat, final String milliSep)
  2. format(final long timeInMillis)
  3. format(long millis)
  4. format(long millis)
  5. format(long millis)
  6. format(long millis, String pattern)
  7. format(long milliseconds, String format)
  8. format(long timeMillis)
  9. format(long timeMillis, String pattern)