Android Calendar Interval Get before(Calendar c, long offset)

Here you can find the source of before(Calendar c, long offset)

Description

before

Declaration

public static Calendar before(Calendar c, long offset) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public static Calendar before(Calendar c, long offset) {
        Calendar calendar = null;
        if (c != null) {
            calendar = c;//from ww  w. j a  v  a  2 s.  c  om
        } else {
            calendar = Calendar.getInstance();
        }

        calendar.setTimeInMillis(calendar.getTimeInMillis() - offset);
        return calendar;
    }
}

Related

  1. daysBetween(Calendar startDate, Calendar endDate)
  2. yearsBetweenDates(Calendar from, Calendar to)
  3. getExactDiff(final Calendar cal1, final Calendar cal2)