Android Date Format getFormatDateAdd(Date date, int amount, String format)

Here you can find the source of getFormatDateAdd(Date date, int amount, String format)

Description

get Format Date Add

License

Apache License

Declaration

public static String getFormatDateAdd(Date date, int amount,
        String format) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class Main {

    public static String getFormatDateAdd(Date date, int amount,
            String format) {/*from ww  w  . j av  a  2 s.  c  om*/
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);
        cal.add(GregorianCalendar.DATE, amount);
        return getFormatDateTime(cal.getTime(), format);
    }

    public static String getFormatDateTime(Date date, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
}

Related

  1. getFormatCurrentTime(String format)
  2. getFormatDate(Date date)
  3. getFormatDate(Date date)
  4. getFormatDate(String format)
  5. getFormatDate(String format)
  6. getFormatDateAdd(Date date, int amount, String format)
  7. getFormatDateTime(Date date, String format)
  8. getFormatDateTime(Date date, String format)
  9. getFormatDateTommorrow(String sourceDate, String format)