Android Date Format getFormatCurrentAdd(int amount, String format)

Here you can find the source of getFormatCurrentAdd(int amount, String format)

Description

get Format Current Add

License

Apache License

Declaration

public static String getFormatCurrentAdd(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 getFormatCurrentAdd(int amount, String format) {

        Date d = getDateAdd(new Date(), amount);

        return getFormatDateTime(d, format);
    }//from ww w  .  ja v a  2 s.c  o m

    public static Date getDateAdd(Date date, int amount) {
        Calendar cal = new GregorianCalendar();
        cal.setTime(date);
        cal.add(GregorianCalendar.DATE, amount);
        return cal.getTime();
    }

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

Related

  1. getCurrentMonth()
  2. getCurrentTime()
  3. getCurrentYear()
  4. getDateEN()
  5. getDefaultFormatter(Date date)
  6. getFormatCurrentTime(String format)
  7. getFormatCurrentTime(String format)
  8. getFormatDate(Date date)
  9. getFormatDate(Date date)