Java Milliseconds printTimeFromMilliseconds(long milliseconds)

Here you can find the source of printTimeFromMilliseconds(long milliseconds)

Description

print Time From Milliseconds

License

Open Source License

Declaration

public static String printTimeFromMilliseconds(long milliseconds) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 1998, 2015 Oracle and/or its affiliates. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 and Eclipse Distribution License v. 1.0
 * which accompanies this distribution.//from ww  w  .ja v  a  2  s.  c o  m
 * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html
 * and the Eclipse Distribution License is available at
 * http://www.eclipse.org/org/documents/edl-v10.php.
 *
 * Contributors:
 *     Oracle - initial API and implementation from Oracle TopLink
 *     dminsky - added countOccurrencesOf(Object, List) API
 *     08/23/2010-2.2 Michael O'Brien
 *        - 323043: application.xml module ordering may cause weaving not to occur causing an NPE.
 *                       warn if expected "_persistence_*_vh" method not found
 *                       instead of throwing NPE during deploy validation.
 ******************************************************************************/

public class Main {
    public static String printTimeFromMilliseconds(long milliseconds) {
        if ((milliseconds > 1000) && (milliseconds < 60000)) {
            return (milliseconds / 1000) + "s";
        }
        if (milliseconds > 60000) {
            return (milliseconds / 60000) + "min "
                    + printTimeFromMilliseconds(milliseconds % 60000);
        }
        return milliseconds + "ms";
    }
}

Related

  1. msToString(long milliseconds)
  2. multiplyRelativeTimeMillis(long duration, long multiplier)
  3. nowMillis()
  4. OLEDateToMillis(double dSerialDate)
  5. parseDate(long milliseconds)
  6. putMillisToByteArray(byte[] buff, long value, int offset)
  7. readableTransferRate(long size, long millis)
  8. relTimestrMillis(long time)
  9. resetHourMinSecMill(final Date date)