Java Calendar from Date getCalendar(Date date)

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

Description

get Calendar

License

Open Source License

Declaration

public static Calendar getCalendar(Date date) 

Method Source Code

//package com.java2s;
/**// w ww .  j av  a 2 s  .  c  om
* License: https://github.com/votingsystem/votingsystem/wiki/Licencia
*/

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

public class Main {
    public static Calendar getCalendar(int year, int month, int day) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(Calendar.YEAR, year);
        calendar.set(Calendar.MONTH, month - 1);//Zero based
        calendar.set(Calendar.DAY_OF_MONTH, day);
        return calendar;
    }

    public static Calendar getCalendar(Date date) {
        Calendar result = Calendar.getInstance();
        result.setTime(date);
        return result;
    }
}

Related

  1. dateToCalendar(java.util.Date date)
  2. DateToCalendar(java.util.Date date)
  3. dateToCalendar(String date)
  4. getCalendar(Date date)
  5. getCalendar(Date date)
  6. getCalendar(Date date, int firstDayOfWeek)
  7. getCalendar(Date date, int step)
  8. getCalendar(Date dt)
  9. getCalendar(Date dt, TimeZone to)