get Next Date For Week from starting milliseconds - Android java.util

Android examples for java.util:Date

Description

get Next Date For Week from starting milliseconds

Demo Code


import android.app.AlarmManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;

public class Main{

    private static final long DAY_MILLS = 1000 * 60 * 60 * 24;
    private static final long WEEK_MILLS = DAY_MILLS * 7;
    //w  w w  .ja va2s.  co m
    public static long getNextDateForWeek(long startMills) {
        long currentMills = System.currentTimeMillis();
        long nextMills = startMills;
        while (currentMills > nextMills) {
            nextMills += WEEK_MILLS;
        }
        return nextMills;
    }
}

Related Tutorials