Java Milliseconds minutusAndSecondsFromMillis(long millis)

Here you can find the source of minutusAndSecondsFromMillis(long millis)

Description

minutus And Seconds From Millis

License

Open Source License

Declaration

public static String minutusAndSecondsFromMillis(long millis) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2012 Pivotal Software, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:/*from w  w  w.  j av  a2  s. c  om*/
 * Pivotal Software, Inc. - initial API and implementation
 *******************************************************************************/

public class Main {
    public static String minutusAndSecondsFromMillis(long millis) {
        return String.format("%d min, %d sec", millis2minutes(millis),
                millis2seconds(millis) - minutes2seconds(millis2minutes(millis)));
    }

    public static long millis2minutes(long millis) {
        return millis / (1000 * 60);
    }

    private static long millis2seconds(long millis) {
        return millis / 1000;
    }

    private static long minutes2seconds(long minutes) {
        return minutes * 60;
    }
}

Related

  1. millisecondOf(Date date)
  2. milliseconds(int offset)
  3. millisecondsBetween(Date start, Date finish)
  4. millisecondsSinceMidnight(Date date)
  5. millisToDate(String stime)
  6. msToString(long milliseconds)
  7. multiplyRelativeTimeMillis(long duration, long multiplier)
  8. nowMillis()
  9. OLEDateToMillis(double dSerialDate)