Java Calendar Create createResetCalendar()

Here you can find the source of createResetCalendar()

Description

Creates a new reset (non-lenient) calendar with the default time zone.

License

MIT License

Return

the reset calendar for the default time zone.

Declaration

public static Calendar createResetCalendar() 

Method Source Code

//package com.java2s;
/*//  w w  w . j  ava2s.c  o m
 * Copyright (c) 2015-2016 QuartzDesk.com.
 * Licensed under the MIT license (https://opensource.org/licenses/MIT).
 */

import java.util.Calendar;

import java.util.GregorianCalendar;

import java.util.TimeZone;

public class Main {
    /**
     * Creates a new reset (non-lenient) calendar with the default time zone.
     *
     * @return the reset calendar for the default time zone.
     */
    public static Calendar createResetCalendar() {
        return createResetCalendar(TimeZone.getDefault());
    }

    /**
     * Creates a new reset (non-lenient) calendar with the given time zone.
     *
     * @param timeZone a time zone.
     * @return the reset calendar.
     */
    public static Calendar createResetCalendar(TimeZone timeZone) {
        Calendar cal = new GregorianCalendar();
        cal.setTimeZone(timeZone);
        cal.clear();
        cal.setFirstDayOfWeek(Calendar.MONDAY); // ISO standard
        cal.setMinimalDaysInFirstWeek(4); // ISO standard
        return cal;
    }
}

Related

  1. createCalendarMidnight(final Date date)
  2. createCalendarWith()
  3. createDateFormatString(Calendar cal)
  4. createDateStr(Calendar calendar)
  5. createIsoCalendar()
  6. createTimestampStr(Calendar para_calendar)
  7. getCalendar()
  8. getCalendar()
  9. getCalendar()