Java Millisecond Format timeFormat(final long milliseconds)

Here you can find the source of timeFormat(final long milliseconds)

Description

Converts into seconds and returns a string in the format . .

License

Apache License

Parameter

Parameter Description
milliseconds a parameter

Return

String

Declaration

public static String timeFormat(final long milliseconds) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.text.DecimalFormat;
import java.text.NumberFormat;

public class Main {
    /**/*from w ww  .j  av a2s .  co m*/
     * Converts into seconds and returns a string in the format
     * {@code <seconds>.<milliseconds>}.
     *
     * @param milliseconds
     * @return String
     */
    public static String timeFormat(final long milliseconds) {
        double seconds = milliseconds / 1000.0d;
        final NumberFormat fmt = new DecimalFormat("#0.000");
        return fmt.format(seconds);
    }
}

Related

  1. prettyPrintTime(long millis)
  2. printDate(long millis)
  3. reverseFormattedDateWithMilliseconds()
  4. stringToTimestampInMilliseconds(String s, DateFormat formatter)
  5. strToDateMillisTimestamp(String dateStr, String formatStr)
  6. timeMillisToString(long timeMillis, String dateFormat)