Java Second Format formatMilliIntervalAsSeconds(long interval)

Here you can find the source of formatMilliIntervalAsSeconds(long interval)

Description

Format a millisecond interval as number of seconds (with fracitonal part).

License

Open Source License

Parameter

Parameter Description
interval interval in milliseconds.

Return

interval as number of seconds (with fracitonal part).

Declaration

public static String formatMilliIntervalAsSeconds(long interval) 

Method Source Code

//package com.java2s;

public class Main {
    /**// ww w .  jav a 2 s.c  o  m
     * Format a millisecond interval as number of seconds (with fracitonal part).
     * 
     * @param interval interval in milliseconds. 
     * @return interval as number of seconds (with fracitonal part).
     */
    public static String formatMilliIntervalAsSeconds(long interval) {
        long seconds = interval / 1000;
        long millis = interval - seconds * 1000;

        StringBuilder buff = new StringBuilder();
        buff.append(seconds).append(".");
        buff.append(millis).append("s");
        return buff.toString();
    }
}

Related

  1. changeSecondsToTime(long seconds)
  2. compareDate(String fistDate, String secondDate, String format)
  3. elapsedSeconds(long startTime)
  4. elapsedSeconds2(long milli)
  5. formatMiliSeconds(long time)
  6. formatMinutesSeconds(final long sourceDuration, final TimeUnit sourceUnit)
  7. formatNanoseconds (final long ns)
  8. formatSecondFractions(long numUnits, int denominator)
  9. formatSeconds(double seconds)