Java Calendar from Date getCalendar(Date date, int step)

Here you can find the source of getCalendar(Date date, int step)

Description

get Calendar

License

Apache License

Declaration

public static Calendar getCalendar(Date date, int step) 

Method Source Code

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

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

public class Main {

    public static Calendar getCalendar(Date date, int step) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//from   ww w.java  2s .  c o  m
        calendar.add(Calendar.DAY_OF_MONTH, step);
        return calendar;
    }

    public static Date add(Date _date, int _calendarField, int _amount) {
        if (_date == null) {
            return _date;
        }
        Calendar c = Calendar.getInstance();
        c.setTime(_date);
        c.add(_calendarField, _amount);
        return c.getTime();
    }
}

Related

  1. dateToCalendar(String date)
  2. getCalendar(Date date)
  3. getCalendar(Date date)
  4. getCalendar(Date date)
  5. getCalendar(Date date, int firstDayOfWeek)
  6. getCalendar(Date dt)
  7. getCalendar(Date dt, TimeZone to)
  8. getCalendar(Date inputDate)