Java Day From getDateByNum(int day)

Here you can find the source of getDateByNum(int day)

Description

get Date By Num

License

Apache License

Declaration

public static Date getDateByNum(int day) 

Method Source Code

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

import java.util.*;

public class Main {

    public static Date getDateByNum(int day) {
        GregorianCalendar gd = new GregorianCalendar(1900, 1, 1);
        Date date = gd.getTime();
        date = nextDay(date, day);/*from w w w .  j a v  a 2 s.c o m*/
        return date;
    }

    public static Date nextDay(Date date, int day) {
        Calendar cal = Calendar.getInstance();
        if (date != null) {
            cal.setTime(date);
        }
        cal.add(Calendar.DAY_OF_YEAR, day);
        return cal.getTime();
    }
}

Related

  1. firstDayOfCentury(final int century)
  2. get23HourOfDay(Date date)
  3. getAge(Date birthDay)
  4. getBeforeDate_(Date date, int day)
  5. getDateByDay(Date date)
  6. getDateFromDayNum(int dayNum)
  7. getDateUpDay(Date d)
  8. getDay(Date date)
  9. getDay(Date date)