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

Declaration

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

Method Source Code

//package com.java2s;

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 w  ww .j  a  v  a2 s.co  m
        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. getFormatDate(Date date)
  2. getFormatDate(Date date)
  3. getFormatDate(String format)
  4. getFormatDate(String format)
  5. getFormatDateAdd(Date date, int amount, String format)
  6. getFormatDateTime(Date date, String format)
  7. getFormatDateTime(Date date, String format)
  8. getFormatDateTommorrow(String sourceDate, String format)
  9. getFormatDateTommorrow(String sourceDate, String format)