Java Date Previous getPrevDueDate(int payperiod, long time)

Here you can find the source of getPrevDueDate(int payperiod, long time)

Description

get Prev Due Date

License

Apache License

Declaration

public static Date getPrevDueDate(int payperiod, long time) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date getPrevDueDate(int payperiod, long time) {
        Calendar now = Calendar.getInstance();
        now.setTimeInMillis(time);/*  w  w  w.j  a v a  2  s. c  o  m*/
        if (payperiod == 1) {
            now.add(Calendar.MONTH, -1);
        } else if (payperiod == 2) {
            now.add(Calendar.MONTH, -3);
        } else if (payperiod == 3) {
            now.add(Calendar.MONTH, -6);
        } else if (payperiod == 4) {
            now.add(Calendar.YEAR, -1);
        }
        return now.getTime();
    }
}

Related

  1. getPreDay(Date date)
  2. getPrefixStartDate(Integer day)
  3. GetPreMonthBeginDate()
  4. getPreMonthDate(Date date, int month)
  5. getPrevDay(Date date)
  6. getPreviousDate(Date date)
  7. getPreviousDate(final Date date)
  8. getPreviousDate(int period)
  9. getPreviousDateStart()