Java Millisecond Format millisecondsToToTimeFormat(long inMs)

Here you can find the source of millisecondsToToTimeFormat(long inMs)

Description

milliseconds To To Time Format

License

Open Source License

Declaration

public static String millisecondsToToTimeFormat(long inMs) 

Method Source Code

//package com.java2s;
/*//from ww w .j  a v  a2s .c o m
 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and contributors.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the GNU Lesser General Public License
 * (LGPL) version 2.1 which accompanies this distribution, and is available at
 * http://www.gnu.org/licenses/lgpl-2.1.html
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * Contributors:
 *     Thibaud arguillere
 */

public class Main {
    public static String millisecondsToToTimeFormat(long inMs) {

        long second = (inMs / 1000) % 60;
        long minute = (inMs / (1000 * 60)) % 60;
        long hour = (inMs / (1000 * 60 * 60)) % 24;

        return String.format("%d:%02d:%02d", hour, minute, second);

    }
}

Related

  1. millisAsTicks(int ms)
  2. milliseconds2String(long millis)
  3. millisecondsPerTick(final int tps)
  4. milliSecondsSince(long startMillis)
  5. milliSecondsToFormatedString(long timeMillis)
  6. milliSekundsToTime(long millisecond)
  7. millisOf(long timestamp)
  8. millisPerBeat(final float bpm)
  9. millisSince(long from)