Java Time Format formatTimeElapsed(long p_millis)

Here you can find the source of formatTimeElapsed(long p_millis)

Description

format elapsed time from millisecond to human readable format

License

Open Source License

Parameter

Parameter Description
p_millis a parameter

Declaration

public static String formatTimeElapsed(long p_millis) 

Method Source Code

//package com.java2s;
/* *********************************************************************
 *
 *  This file is part of Full Metal Galaxy.
 *  http://www.fullmetalgalaxy.com//from w  w  w.ja v  a  2 s.c  om
 *
 *  Full Metal Galaxy is free software: you can redistribute it and/or 
 *  modify it under the terms of the GNU Affero General Public License
 *  as published by the Free Software Foundation, either version 3 of 
 *  the License, or (at your option) any later version.
 *
 *  Full Metal Galaxy 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 Affero General Public License for more details.
 *
 *  You should have received a copy of the GNU Affero General Public 
 *  License along with Full Metal Galaxy.  
 *  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Copyright 2010 to 2015 Vincent Legendre
 *
 * *********************************************************************/

public class Main {
    /**
     * format elapsed time from millisecond to human readable format
     * @param p_millis
     * @return
     */
    public static String formatTimeElapsed(long p_millis) {
        // convert p_millis to minutes
        p_millis /= (1000 * 60);
        return "" + (p_millis / 60) + "h" + (p_millis % 60);
    }
}

Related

  1. formatTimeDiff(long finishTime, long startTime)
  2. formatTimeDifference(long ms)
  3. formatTimeDifference(long time1, long time2)
  4. formatTimeDigital(int time)
  5. formatTimeDuringHour(long mss)
  6. formatTimeInfo(long time)
  7. formatTimeInMilisec(long time)
  8. formatTimeInNanos(long time)
  9. formatTimeInterval(final long time)