Android Utililty Methods Date to Calendar Convert

List of utility methods to do Date to Calendar Convert

Description

The list of methods to do Date to Calendar Convert are organized into topic(s).

Method

CalendarDate2Calendar(Date d)
Date Calendar
Calendar c = Calendar.getInstance();
c.setTime(d);
return c;
CalendargetCalendar(Date date)
get Calendar
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
GregorianCalendargetCalendar(Date day)
get Calendar
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTime(day);
return gregorianCalendar;
CalendartoCalendar(Date date)
Convert a Date into a Calendar .
Calendar c = Calendar.getInstance();
c.setTime(date);
return c;
CalendargetCalendar(Date date)
get Calendar
if (date == null)
    return null;
Calendar c = new GregorianCalendar();
c.setTime(date);
return c;
CalendargetCalendarFromDate(Date date)
Get Calendar instance based on given Date object.
if (StringUtils.isNull(date)) {
    throw new NullPointerException("date cannot be null");
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
CalendarcalendarFromDate(Date d)
calendar From Date
Calendar c = Calendar.getInstance();
c.setTime(d);
return c;
CalendarcalendarDate(Date date)
calendar Date
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
Calendarconvert(Date date)
convert
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
return calendar;
intgetCalendarField(Date date, int field)
get Calendar Field
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar.get(field);