Java Calendar Create getCalendar()

Here you can find the source of getCalendar()

Description

get Calendar

License

Open Source License

Declaration

public static Calendar getCalendar() 

Method Source Code

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

import java.util.Calendar;

public class Main {

    public static Calendar getCalendar() {

        return getCalendar(null);
    }/*from ww w  . j a v a2 s  . c  o m*/

    public static Calendar getCalendar(Integer year) {

        return getCalendar(year, null, null);
    }

    public static Calendar getCalendar(Integer year, Integer month) {

        return getCalendar(year, month, null);
    }

    public static Calendar getCalendar(Integer year, Integer month, Integer date) {

        Calendar calendar = Calendar.getInstance();

        if (year != null)
            calendar.set(Calendar.YEAR, year);

        if (month != null)
            calendar.set(Calendar.MONTH, month - 1);

        if (date != null)
            calendar.set(Calendar.DAY_OF_MONTH, date);

        return calendar;
    }
}

Related

  1. getCalendar()
  2. getCalendar()
  3. getCalendar()
  4. getCalendar()
  5. getCalendar()
  6. getCalendar()
  7. getCalendar()
  8. getCalendar()
  9. getCalendar()