Java Calendar UTC getUTCCalendar()

Here you can find the source of getUTCCalendar()

Description

get UTC Calendar

License

Open Source License

Declaration

public static Calendar getUTCCalendar() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

import java.util.Locale;
import java.util.TimeZone;

public class Main {
    /**/*from w w w .j  a  v  a2s .  c  o  m*/
     * UTC
     */
    public final static TimeZone UTC = TimeZone.getTimeZone("UTC");

    public static Calendar getUTCCalendar() {
        return getCalendar(UTC, null);
    }

    /**
     * Returns a calendar instance. If a context user is given then the user's
     * time zone and locale will be used if given.
     */
    public static Calendar getCalendar() {
        return getCalendar(null, null);
    }

    /**
     * Returns a calendar instance. If a context user is given then the user's
     * time zone and locale will be used if given.
     * 
     * @param locale if given this locale will overwrite any the context user's
     *            locale.
     */
    public static Calendar getCalendar(final Locale locale) {
        return getCalendar(null, locale);
    }

    public static Calendar getCalendar(TimeZone timeZone, Locale locale) {
        if (locale == null) {
            locale = Locale.getDefault();
        }
        if (timeZone == null) {
            timeZone = TimeZone.getDefault();
        }
        return Calendar.getInstance(timeZone, locale);
    }
}

Related

  1. getCalendarUTC()
  2. getCalendarUTC()
  3. getCalendarUTC(long timeMS)
  4. getLocalCalendarFromUTC(Calendar utc)
  5. getUtcCalendar()
  6. getUTCCalendar()
  7. getUtcCalendar()
  8. getUTCCalendar()