Java Time Readable Format toTimeHumanReadable(final long time)

Here you can find the source of toTimeHumanReadable(final long time)

Description

Convert a number of milliseconds into a human reading string.

License

Open Source License

Parameter

Parameter Description
time time in ms

Return

a the time in ms

Declaration

public static final String toTimeHumanReadable(final long time) 

Method Source Code

//package com.java2s;
/*//from www  .  j  ava2s . c  om
 *                  Teolenn development code
 *
 * This code may be freely distributed and modified under the
 * terms of the GNU General Public License version 2 or later. This
 * should be distributed with the code. If you do not have a copy,
 * see:
 *
 *      http://www.gnu.org/licenses/gpl-2.0.txt
 *
 * Copyright for this code is held jointly by the microarray platform
 * of the ?cole Normale Sup?rieure and the individual authors.
 * These should be listed in @author doc comments.
 *
 * For more information on the Teolenn project and its aims,
 * or to join the Teolenn Google group, visit the home page
 * at:
 *
 *      http://www.transcriptome.ens.fr/teolenn
 *
 */

public class Main {
    /**
     * Convert a number of milliseconds into a human reading string.
     * @param time time in ms
     * @return a the time in ms
     */
    public static final String toTimeHumanReadable(final long time) {

        long min = time / (60 * 1000);
        long minRest = time % (60 * 1000);
        long sec = minRest / 1000;

        long mili = minRest % 1000;

        return String.format("%02d:%02d.%03d", min, sec, mili);
    }
}

Related

  1. toTime(long nanos)
  2. toTime(long time)
  3. toTime2(int value, int nanos, int meta)
  4. toTimeExpression(long ms, int frames)
  5. toTimeFormat(String _srcTime)
  6. toTimeSpanDescription(long time)
  7. toTimestamp(long time)
  8. toTimeStampString(String timeStr)
  9. toTimeString(double millis)