Android Milliseconds to Hour Convert getHoursAndMinutes(long dateTimeMillis)

Here you can find the source of getHoursAndMinutes(long dateTimeMillis)

Description

get Hours And Minutes

License

Open Source License

Declaration

public static String getHoursAndMinutes(long dateTimeMillis) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String getHoursAndMinutes(long dateTimeMillis) {
        String format = String.format("%%0%dd", 2);
        long elapsedTime = dateTimeMillis / 1000;
        String minutes = String.format(format, (elapsedTime % 3600) / 60);
        String hours = String.format(format, elapsedTime / 3600);
        return hours + ":" + minutes;
    }// w  w  w .  ja  v a2s. c  om
}

Related

  1. getHour(long dateTimeMillis)