Java Calendar from Date convertDateToCalendar(Date date)

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

Description

convert Date To Calendar

License

Open Source License

Declaration

public static Calendar convertDateToCalendar(Date date) 

Method Source Code

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

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

public class Main {
    public static Calendar convertDateToCalendar(Date date) {
        if (date != null) {
            Calendar cal = Calendar.getInstance();
            cal.setTimeZone(TimeZone.getTimeZone("GMT"));
            cal.setTime(date);/* w  ww  .j  a  va 2 s  . c o  m*/
            return cal;
        } else {
            return null;
        }
    }
}

Related

  1. calendarFromDate(Date date)
  2. convertDateToCalendar(Date date)
  3. convertDateToCalendar(Date date)
  4. convertDateToCalendar(final Date d, boolean lenient)
  5. convertDateToCalendar(final Date dateToCompare)
  6. date2Calendar(Date date)