Java Date to Calendar toCalendar(final Date date)

Here you can find the source of toCalendar(final Date date)

Description

to Calendar

License

Apache License

Declaration

public static Calendar toCalendar(final Date date) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

import java.util.Date;
import java.util.Locale;

import java.util.TimeZone;

public class Main {
    public static Calendar toCalendar(final Date date) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);// w w w  . j a v  a  2 s .c  o  m
        return cal;
    }

    public static Calendar toCalendar(final Date date, final Locale locale) {
        Calendar cal = Calendar.getInstance(locale);
        cal.setTime(date);
        return cal;
    }

    public static Calendar toCalendar(final Date date, final TimeZone timeZone) {
        Calendar cal = Calendar.getInstance(timeZone);
        cal.setTime(date);
        return cal;
    }

    public static Calendar toCalendar(final Date date, final TimeZone timeZone, final Locale locale) {
        Calendar cal = Calendar.getInstance(timeZone, locale);
        cal.setTime(date);
        return cal;
    }
}

Related

  1. toCalendar(Date date)
  2. toCalendar(Date date)
  3. toCalendar(Date date)
  4. toCalendar(Date dtime)
  5. toCalendar(Date value)
  6. toCalendar(final Date date, final Locale locale)
  7. toCalendar(final Date date, final TimeZone tz)