Android Milliseconds to Minutes And Seconds Convert getMillisecondsUntilNextMinute()

Here you can find the source of getMillisecondsUntilNextMinute()

Description

get Milliseconds Until Next Minute

Declaration

public static int getMillisecondsUntilNextMinute() 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static final int MINUTE_IN_MILLISECONDS = 60000;

    public static int getMillisecondsUntilNextMinute() {
        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;
    }/* w w  w .  j av  a2 s  .  com*/
}

Related

  1. milisecondsToMinutesAndSeconds(int milliseconds)
  2. getMinute(long dateTimeMillis)