Java Calendar Create getCalendarDateFromToday(final int numDays)

Here you can find the source of getCalendarDateFromToday(final int numDays)

Description

Flips through the Calendar from the current date over the given number of days to fetch the required date in milli seconds.

License

Open Source License

Parameter

Parameter Description
numDays Number of days to flip through in the calendar.

Return

timeInMillis Date stamp in milli seconds after flipping through the calendar.

Declaration

public static long getCalendarDateFromToday(final int numDays) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**/*from  www.  j a v a 2  s  . com*/
     * Flips through the Calendar from the current date
     * over the given number of days to fetch the required date
     * in milli seconds.
     * @param numDays
     *             Number of days to flip through in the calendar.
     * @return timeInMillis
     *             Date stamp in milli seconds after flipping through
     *             the calendar.
     */
    public static long getCalendarDateFromToday(final int numDays) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(new Date());
        cal.add(Calendar.DAY_OF_MONTH, numDays);
        return cal.getTimeInMillis();
    }
}

Related

  1. getCalendarByName(String timeZone)
  2. getCalendarBySpecific(int year, int month, int date, int hour)
  3. getCalendarByValue(String timeZone)
  4. getCalendarDate()
  5. getCalendarDate(Calendar calendar)
  6. getCalendarDayString(Calendar date)
  7. getCalendarField(char c)
  8. getCalendarField(Date date, int calFieldId)
  9. getCalendarFieldName(int field)