Java Utililty Methods Calendar from Date

List of utility methods to do Calendar from Date

Description

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

Method

CalendardateToCalendar(Date d)
date To Calendar
Calendar c1 = new GregorianCalendar();
c1.setTime(d);
return c1;
CalendardateToCalendar(Date d)
Returns a java Date as a calendar.
if (d == null) {
    return null;
Calendar c = Calendar.getInstance();
c.setTime(d);
return c;
CalendardateToCalendar(Date date)
Convert the given Date object to a Calendar instance.
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
CalendardateToCalendar(Date date)
Converts a Date object into a Calendar object.
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
return calendar;
CalendardateToCalendar(Date date)
date To Calendar
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
CalendardateToCalendar(int year, int month, int day)
date To Calendar
Calendar cal = Calendar.getInstance();
cal.set(Calendar.MONTH, month - 1);
cal.set(Calendar.DATE, day);
cal.set(Calendar.YEAR, year);
return cal;
CalendardateToCalendar(java.util.Date date)
Converte um java.sql.Date para Calendar
Calendar calendar = new GregorianCalendar();
calendar.setTime(date);
return calendar;
java.util.CalendarDateToCalendar(java.util.Date date)
Date To Calendar
Calendar cal = Calendar.getInstance();
cal.setTime(date);
return cal;
CalendardateToCalendar(String date)
date To Calendar
int y, m, d;
Calendar c = Calendar.getInstance();
y = atoi(date.substring(6));
if (y < 49)
    y += 2000;
else
    y += 1900;
d = atoi(date.substring(3));
...
CalendargetCalendar(Date date)
get Calendar
Calendar calendar = GregorianCalendar.getInstance();
if (date == null) {
    calendar.setTime(new Date());
} else {
    calendar.setTime(date);
return calendar;