Java TimeZone Usage datePlusDays(Date date, int days)

Here you can find the source of datePlusDays(Date date, int days)

Description

date Plus Days

License

Open Source License

Declaration

public static Date datePlusDays(Date date, int days) 

Method Source Code

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

import java.util.*;

public class Main {
    private static int DAY_OF_YEAR = Calendar.DAY_OF_YEAR;

    public static Date datePlusDays(Date date, int days) {
        Calendar calendar = getMoscowCalendar();
        calendar.setTime(date);//from   w w w  .  j  av a  2 s. c om
        calendar.add(Calendar.DAY_OF_YEAR, days);
        return calendar.getTime();
    }

    public static Calendar getMoscowCalendar() {
        return new GregorianCalendar(getMoscowTimeZone());
    }

    public static Calendar getMoscowCalendar(Date time) {
        Calendar c = getMoscowCalendar();
        c.setTime(time);
        return c;
    }

    public static TimeZone getMoscowTimeZone() {
        return java.util.TimeZone.getTimeZone("Europe/Moscow");
    }
}

Related

  1. assertTimeZoneNotNull(String methodName, TimeZone timeZone)
  2. buildTimezone(int hours, int minutes)
  3. computeTimeZoneOffsetInHours(TimeZone timeZone, long currentDatetime)
  4. createPostgresTimeZone()
  5. createTaiTimeZone(int leapSecs)
  6. findTimeZoneInDate(String date)
  7. isInEasternEightZones()
  8. isKeepTimeZone(TimeZone tz)
  9. isSameDayOfMillis(final long ms1, final long ms2)