Android Utililty Methods Milliseconds to Minutes And Seconds Convert

List of utility methods to do Milliseconds to Minutes And Seconds Convert

Description

The list of methods to do Milliseconds to Minutes And Seconds Convert are organized into topic(s).

Method

StringmilisecondsToMinutesAndSeconds(int milliseconds)
miliseconds To Minutes And Seconds
int seconds = (int) (milliseconds / 1000) % 60;
int minutes = (int) ((milliseconds / (1000 * 60)) % 60);
int hours = (int) ((milliseconds / (1000 * 60 * 60)) % 24);
StringBuffer buffer = new StringBuffer();
String prefix = "";
if (hours > 0) {
    prefix = hours < 10 ? "0" : "";
    buffer.append(prefix + hours + ":");
...
intgetMinute(long dateTimeMillis)
get Minute
SimpleDateFormat format = new SimpleDateFormat("mm");
StringBuilder dateString = new StringBuilder(
        format.format(dateTimeMillis));
return Integer.parseInt(dateString.toString());
intgetMillisecondsUntilNextMinute()
get Milliseconds Until Next Minute
Calendar c = Calendar.getInstance();
long ms = c.getTimeInMillis();
long nextminute = (ms + (MINUTE_IN_MILLISECONDS - 1))
        / MINUTE_IN_MILLISECONDS * MINUTE_IN_MILLISECONDS;
int result = (int) (nextminute - ms);
return result;