Java Date Offset getOffsetDateInFormat(int offsetDay, String pattern)

Here you can find the source of getOffsetDateInFormat(int offsetDay, String pattern)

Description

get Offset Date In Format

License

Open Source License

Declaration

public static String getOffsetDateInFormat(int offsetDay, String pattern) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

public class Main {
    public static String getOffsetDateInFormat(int offsetDay, String pattern) {
        DateFormat dateFormat = new SimpleDateFormat(pattern);
        Calendar cal = Calendar.getInstance();
        if (offsetDay != 0) {
            cal.add(Calendar.DATE, offsetDay);
        }//  w ww.  j  a  va2  s .c  o m
        return dateFormat.format(cal.getTime());
    }
}

Related

  1. getOffsetDate(Date protoDate, int dayOffset)
  2. getOffsetDate(String startTime, int field, int offset)
  3. getOffsetDate(String strDate, int offset, String pFormat)
  4. getOffsetDate(String strDate, int offset, String pFormat)
  5. getOffsetDateToDate(Date pDate, int offset)
  6. getOffsetMins(String strDate, String strDate2)
  7. getOffsetMonth(Date pDate, int offset, String pFormat)