java.util

Class Calendar

Implemented Interfaces:
Cloneable, Comparable<T>, Serializable
Known Direct Subclasses:
GregorianCalendar

public abstract class Calendar
extends Object
implements Serializable, Cloneable, Comparable<T>

The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week. An instant in time can be represented by a millisecond value that is an offset from the Epoch, January 1, 1970 00:00:00.000 GMT (Gregorian).

The class also provides additional fields and methods for implementing a concrete calendar system outside the package. Those fields and methods are defined as protected.

Like other locale-sensitive classes, Calendar provides a class method, getInstance, for getting a generally useful object of this type. Calendar's getInstance method returns a Calendar object whose calendar fields have been initialized with the current date and time:

     Calendar rightNow = Calendar.getInstance();
 

A Calendar object can produce all the calendar field values needed to implement the date-time formatting for a particular language and calendar style (for example, Japanese-Gregorian, Japanese-Traditional). Calendar defines the range of values returned by certain calendar fields, as well as their meaning. For example, the first month of the calendar system has value MONTH == JANUARY for all calendars. Other values are defined by the concrete subclass, such as ERA. See individual field documentation and subclass documentation for details.

Getting and Setting Calendar Field Values

The calendar field values can be set by calling the set methods. Any field values set in a Calendar will not be interpreted until it needs to calculate its time value (milliseconds from the Epoch) or values of the calendar fields. Calling the get, getTimeInMillis, getTime, add and roll involves such calculation.

Leniency

Calendar has two modes for interpreting the calendar fields, lenient and non-lenient. When a Calendar is in lenient mode, it accepts a wider range of calendar field values than it produces. When a Calendar recomputes calendar field values for return by get(), all of the calendar fields are normalized. For example, a lenient GregorianCalendar interprets MONTH == JANUARY, DAY_OF_MONTH == 32 as February 1.

When a Calendar is in non-lenient mode, it throws an exception if there is any inconsistency in its calendar fields. For example, a GregorianCalendar always produces DAY_OF_MONTH values between 1 and the length of the month. A non-lenient GregorianCalendar throws an exception upon calculating its time or calendar field values if any out-of-range field value has been set.

First Week

Calendar defines a locale-specific seven day week using two parameters: the first day of the week and the minimal days in first week (from 1 to 7). These numbers are taken from the locale resource data when a Calendar is constructed. They may also be specified explicitly through the methods for setting their values.

When setting or getting the WEEK_OF_MONTH or WEEK_OF_YEAR fields, Calendar must determine the first week of the month or year as a reference point. The first week of a month or year is defined as the earliest seven day period beginning on getFirstDayOfWeek() and containing at least getMinimalDaysInFirstWeek() days of that month or year. Weeks numbered ..., -1, 0 precede the first week; weeks numbered 2, 3,... follow it. Note that the normalized numbering returned by get() may be different. For example, a specific Calendar subclass may designate the week before week 1 of a year as week n of the previous year.

Calendar Fields Resolution

When computing a date and time from the calendar fields, there may be insufficient information for the computation (such as only year and month with no day of month), or there may be inconsistent information (such as Tuesday, July 15, 1996 (Gregorian) -- July 15, 1996 is actually a Monday). Calendar will resolve calendar field values to determine the date and time in the following way.

If there is any conflict in calendar field values, Calendar gives priorities to calendar fields that have been set more recently. The following are the default combinations of the calendar fields. The most recent combination, as determined by the most recently set single field, will be used.

For the date fields:

 YEAR + MONTH + DAY_OF_MONTH
 YEAR + MONTH + WEEK_OF_MONTH + DAY_OF_WEEK
 YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK
 YEAR + DAY_OF_YEAR
 YEAR + DAY_OF_WEEK + WEEK_OF_YEAR
 
For the time of day fields:
 HOUR_OF_DAY
 AM_PM + HOUR
 

If there are any calendar fields whose values haven't been set in the selected field combination, Calendar uses their default values. The default value of each field may vary by concrete calendar systems. For example, in GregorianCalendar, the default of a field is the same as that of the start of the Epoch: i.e., YEAR = 1970, MONTH = JANUARY, DAY_OF_MONTH = 1, etc.

Note: There are certain possible ambiguities in interpretation of certain singular times, which are resolved in the following ways:

  1. 23:59 is the last minute of the day and 00:00 is the first minute of the next day. Thus, 23:59 on Dec 31, 1999 < 00:00 on Jan 1, 2000 < 00:01 on Jan 1, 2000.
  2. Although historically not precise, midnight also belongs to "am", and noon belongs to "pm", so on the same day, 12:00 am (midnight) < 12:01 am, and 12:00 pm (noon) < 12:01 pm

The date or time format strings are not part of the definition of a calendar, as those must be modifiable or overridable by the user at runtime. Use DateFormat to format dates.

Field Manipulation

The calendar fields can be changed using three methods: set(), add(), and roll().

set(f, value) changes calendar field f to value. In addition, it sets an internal member variable to indicate that calendar field f has been changed. Although calendar field f is changed immediately, the calendar's time value in milliseconds is not recomputed until the next call to get(), getTime(), getTimeInMillis(), add(), or roll() is made. Thus, multiple calls to set() do not trigger multiple, unnecessary computations. As a result of changing a calendar field using set(), other calendar fields may also change, depending on the calendar field, the calendar field value, and the calendar system. In addition, get(f) will not necessarily return value set by the call to the set method after the calendar fields have been recomputed. The specifics are determined by the concrete calendar class.

Example: Consider a GregorianCalendar originally set to August 31, 1999. Calling set(Calendar.MONTH, Calendar.SEPTEMBER) sets the date to September 31, 1999. This is a temporary internal representation that resolves to October 1, 1999 if getTime()is then called. However, a call to set(Calendar.DAY_OF_MONTH, 30) before the call to getTime() sets the date to September 30, 1999, since no recomputation occurs after set() itself.

add(f, delta) adds delta to field f. This is equivalent to calling set(f, get(f) + delta) with two adjustments:

Add rule 1. The value of field f after the call minus the value of field f before the call is delta, modulo any overflow that has occurred in field f. Overflow occurs when a field value exceeds its range and, as a result, the next larger field is incremented or decremented and the field value is adjusted back into its range.

Add rule 2. If a smaller field is expected to be invariant, but it is impossible for it to be equal to its prior value because of changes in its minimum or maximum after field f is changed or other constraints, such as time zone offset changes, then its value is adjusted to be as close as possible to its expected value. A smaller field represents a smaller unit of time. HOUR is a smaller field than DAY_OF_MONTH. No adjustment is made to smaller fields that are not expected to be invariant. The calendar system determines what fields are expected to be invariant.

In addition, unlike set(), add() forces an immediate recomputation of the calendar's milliseconds and all fields.

Example: Consider a GregorianCalendar originally set to August 31, 1999. Calling add(Calendar.MONTH, 13) sets the calendar to September 30, 2000. Add rule 1 sets the MONTH field to September, since adding 13 months to August gives September of the next year. Since DAY_OF_MONTH cannot be 31 in September in a GregorianCalendar, add rule 2 sets the DAY_OF_MONTH to 30, the closest possible value. Although it is a smaller field, DAY_OF_WEEK is not adjusted by rule 2, since it is expected to change when the month changes in a GregorianCalendar.

roll(f, delta) adds delta to field f without changing larger fields. This is equivalent to calling add(f, delta) with the following adjustment:

Roll rule. Larger fields are unchanged after the call. A larger field represents a larger unit of time. DAY_OF_MONTH is a larger field than HOUR.

Example: See GregorianCalendar.roll(int,int).

Usage model. To motivate the behavior of add() and roll(), consider a user interface component with increment and decrement buttons for the month, day, and year, and an underlying GregorianCalendar. If the interface reads January 31, 1999 and the user presses the month increment button, what should it read? If the underlying implementation uses set(), it might read March 3, 1999. A better result would be February 28, 1999. Furthermore, if the user presses the month increment button again, it should read March 31, 1999, not March 28, 1999. By saving the original date and using either add() or roll(), depending on whether larger fields should be affected, the user interface can behave as most users will intuitively expect.

Since:
JDK1.1
See Also:
System.currentTimeMillis(), Date, GregorianCalendar, TimeZone, DateFormat, Serialized Form

Field Summary

static int
AM
Value of the AM_PM field indicating the period of the day from midnight to just before noon.
static int
AM_PM
Field number for get and set indicating whether the HOUR is before or after noon.
static int
APRIL
Value of the MONTH field indicating the fourth month of the year.
static int
AUGUST
Value of the MONTH field indicating the eighth month of the year.
static int
DATE
Field number for get and set indicating the day of the month.
static int
DAY_OF_MONTH
Field number for get and set indicating the day of the month.
static int
DAY_OF_WEEK
Field number for get and set indicating the day of the week.
static int
DAY_OF_WEEK_IN_MONTH
Field number for get and set indicating the ordinal number of the day of the week within the current month.
static int
DAY_OF_YEAR
Field number for get and set indicating the day number within the current year.
static int
DECEMBER
Value of the MONTH field indicating the twelfth month of the year.
static int
DST_OFFSET
Field number for get and set indicating the daylight savings offset in milliseconds.
static int
ERA
Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar.
static int
FEBRUARY
Value of the MONTH field indicating the second month of the year.
static int
FIELD_COUNT
The number of distinct fields recognized by get and set.
static int
FRIDAY
Value of the DAY_OF_WEEK field indicating Friday.
static int
HOUR
Field number for get and set indicating the hour of the morning or afternoon.
static int
HOUR_OF_DAY
Field number for get and set indicating the hour of the day.
static int
JANUARY
Value of the MONTH field indicating the first month of the year.
static int
JULY
Value of the MONTH field indicating the seventh month of the year.
static int
JUNE
Value of the MONTH field indicating the sixth month of the year.
static int
MARCH
Value of the MONTH field indicating the third month of the year.
static int
MAY
Value of the MONTH field indicating the fifth month of the year.
static int
MILLISECOND
Field number for get and set indicating the millisecond within the second.
static int
MINUTE
Field number for get and set indicating the minute within the hour.
static int
MONDAY
Value of the DAY_OF_WEEK field indicating Monday.
static int
MONTH
Field number for get and set indicating the month.
static int
NOVEMBER
Value of the MONTH field indicating the eleventh month of the year.
static int
OCTOBER
Value of the MONTH field indicating the tenth month of the year.
static int
PM
Value of the AM_PM field indicating the period of the day from noon to just before midnight.
static int
SATURDAY
Value of the DAY_OF_WEEK field indicating Saturday.
static int
SECOND
Field number for get and set indicating the second within the minute.
static int
SEPTEMBER
Value of the MONTH field indicating the ninth month of the year.
static int
SUNDAY
Value of the DAY_OF_WEEK field indicating Sunday.
static int
THURSDAY
Value of the DAY_OF_WEEK field indicating Thursday.
static int
TUESDAY
Value of the DAY_OF_WEEK field indicating Tuesday.
static int
UNDECIMBER
Value of the MONTH field indicating the thirteenth month of the year.
static int
WEDNESDAY
Value of the DAY_OF_WEEK field indicating Wednesday.
static int
WEEK_OF_MONTH
Field number for get and set indicating the week number within the current month.
static int
WEEK_OF_YEAR
Field number for get and set indicating the week number within the current year.
static int
YEAR
Field number for get and set indicating the year.
static int
ZONE_OFFSET
Field number for get and set indicating the raw offset from GMT in milliseconds.
protected boolean
areFieldsSet
True if fields[] are in sync with the currently set time.
protected int[]
fields
The calendar field values for the currently set time for this calendar.
protected boolean[]
isSet
The flags which tell if a specified calendar field for the calendar is set.
protected boolean
isTimeSet
True if then the value of time is valid.
protected long
time
The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.

Constructor Summary

Calendar()
Constructs a Calendar with the default time zone and locale.
Calendar(TimeZone zone, Locale aLocale)
Constructs a calendar with the specified time zone and locale.

Method Summary

abstract void
add(int field, int amount)
Adds or subtracts the specified amount of time to the given calendar field, based on the calendar's rules.
boolean
after(Object when)
Returns whether this Calendar represents a time after the time represented by the specified Object.
boolean
before(Object when)
Returns whether this Calendar represents a time before the time represented by the specified Object.
void
clear()
Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined.
void
clear(int field)
Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined.
Object
clone()
Creates and returns a copy of this object.
int
compareTo(Calendar anotherCalendar)
Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.
protected void
complete()
Fills in any unset fields in the calendar fields.
protected abstract void
computeFields()
Converts the current millisecond time value time to calendar field values in fields[].
protected abstract void
computeTime()
Converts the current calendar field values in fields[] to the millisecond time value time.
boolean
equals(Object obj)
Compares this Calendar to the specified Object.
int
get(int field)
Returns the value of the given calendar field.
int
getActualMaximum(int field)
Returns the maximum value that the specified calendar field could have, given the time value of this Calendar.
int
getActualMinimum(int field)
Returns the minimum value that the specified calendar field could have, given the time value of this Calendar.
static Locale[]
getAvailableLocales()
Returns an array of all locales for which the getInstance methods of this class can return localized instances.
int
getFirstDayOfWeek()
Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
abstract int
getGreatestMinimum(int field)
Returns the highest minimum value for the given calendar field of this Calendar instance.
static Calendar
getInstance()
Gets a calendar using the default time zone and locale.
static Calendar
getInstance(Locale aLocale)
Gets a calendar using the default time zone and specified locale.
static Calendar
getInstance(TimeZone zone)
Gets a calendar using the specified time zone and default locale.
static Calendar
getInstance(TimeZone zone, Locale aLocale)
Gets a calendar with the specified time zone and locale.
abstract int
getLeastMaximum(int field)
Returns the lowest maximum value for the given calendar field of this Calendar instance.
abstract int
getMaximum(int field)
Returns the maximum value for the given calendar field of this Calendar instance.
int
getMinimalDaysInFirstWeek()
Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1.
abstract int
getMinimum(int field)
Returns the minimum value for the given calendar field of this Calendar instance.
Date
getTime()
Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
long
getTimeInMillis()
Returns this Calendar's time value in milliseconds.
TimeZone
getTimeZone()
Gets the time zone.
int
hashCode()
Returns a hash code for this calendar.
protected int
internalGet(int field)
Returns the value of the given calendar field.
boolean
isLenient()
Tells whether date/time interpretation is to be lenient.
boolean
isSet(int field)
Determines if the given calendar field has a value set, including cases that the value has been set by internal fields calculations triggered by a get method call.
abstract void
roll(int field, boolean up)
Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields.
void
roll(int field, int amount)
Adds the specified (signed) amount to the specified calendar field without changing larger fields.
void
set(int field, int value)
Sets the given calendar field to the given value.
void
set(int year, int month, int date)
Sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH.
void
set(int year, int month, int date, int hourOfDay, int minute)
Sets the values for the calendar fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, and MINUTE.
void
set(int year, int month, int date, int hourOfDay, int minute, int second)
Sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR, MINUTE, and SECOND.
void
setFirstDayOfWeek(int value)
Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
void
setLenient(boolean lenient)
Specifies whether or not date/time interpretation is to be lenient.
void
setMinimalDaysInFirstWeek(int value)
Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call this method with value 1.
void
setTime(Date date)
Sets this Calendar's time with the given Date.
void
setTimeInMillis(long millis)
Sets this Calendar's current time from the given long value.
void
setTimeZone(TimeZone value)
Sets the time zone with the given time zone value.
String
toString()
Return a string representation of this calendar.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

AM

public static final int AM
Value of the AM_PM field indicating the period of the day from midnight to just before noon.
Field Value:
0
Usages and Demos :

View More Examples of Calendar.AM
   1:     select.setDefaultValue(defaultValue);
   2:     select.addItem(Calendar.AM, "AM");
   3:     select.addItem(Calendar.PM, "PM");
   4:     return select;
   5:   }

View Full Code Here
   1:         calendar1.set(Calendar.MINUTE, 42);
   2:         calendar1.set(Calendar.AM_PM, Calendar.AM);
   3:         calendar1.set(Calendar.SECOND, 43);
   4:         calendar1.set(Calendar.MILLISECOND, 0);
   5:         

View Full Code Here
   1:     {
   2:         checkTime(10, 5, 30, Calendar.AM, "10:05:30 AM");
   3:     }
   4:         ...
   5:         theBaseValueParser.add(TimeSelector.SECOND_SUFFIX, 0);
   6:         theBaseValueParser.add(TimeSelector.AMPM_SUFFIX, Calendar.AM);
   7: 
   8:         ...
   9:     {
  10:         checkTime(12, 0, 0, Calendar.AM, "12:00:00 AM");
  11:     }

View Full Code Here
   1:         cal.set(Calendar.MILLISECOND, 0);
   2:         cal.set(Calendar.AM_PM, Calendar.AM);
   3:         cal.getTime();
   4:         System.out.println(cal);

View Full Code Here
   1:     public DynamicAMPMSpinField() {
   2:         iCurrentValue = Calendar.AM;
   3:         textField = new JTextField();
   4:         ...
   5:         iCurrentValue = value;
   6:         if (value==Calendar.AM){
   7:             textField.setText("AM");
   8:         ...
   9:         if (textField.getText().equals("AM")){
  10:             return Calendar.AM;
  11:         }else{

View Full Code Here

AM_PM

public static final int AM_PM
Field number for get and set indicating whether the HOUR is before or after noon. E.g., at 10:04:15.250 PM the AM_PM is PM.
Field Value:
9
See Also:
AM, PM, HOUR
Usages and Demos :

View More Examples of Calendar.AM_PM
   1: 
   2:     cal.add(Calendar.AM_PM, 1);
   3:     System.out.println(df.format(cal.getTime()));
   4:         ...
   5: 
   6:     cal.add(Calendar.AM_PM, 1);
   7:     System.out.println(df.format(cal.getTime()));
   8:   }
   9: }

View Full Code Here
   1:         calendar1.set(Calendar.MINUTE, 42);
   2:         calendar1.set(Calendar.AM_PM, Calendar.AM);
   3:         calendar1.set(Calendar.SECOND, 43);
   4:         calendar1.set(Calendar.MILLISECOND, 0);
   5:         

View Full Code Here
   1:     calendar.set(Calendar.MINUTE, 59);
   2:     calendar.set(Calendar.AM_PM, Calendar.PM);
   3:     calendar.set(Calendar.SECOND, 59);
   4:      calendar.set(Calendar.MILLISECOND, 999);
   5:         calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

View Full Code Here
   1:     calendar.set(Calendar.MINUTE, 59);
   2:     calendar.set(Calendar.AM_PM, Calendar.PM);
   3:     calendar.set(Calendar.SECOND, 59);
   4:      calendar.set(Calendar.MILLISECOND, 999);
   5:         calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

View Full Code Here
   1:         cal.set(Calendar.MINUTE, 0);
   2:         cal.set(Calendar.AM_PM, Calendar.PM);
   3:       }
   4:         ...
   5:       minute = cal.get(Calendar.MINUTE);
   6:       AMPM = cal.get(Calendar.AM_PM);
   7:       DateFormat formatter = (DateFormat) DateFormat.getTimeInstance(
   8:           DateFormat.SHORT, locale);
   9:       if (formatter.format(cal.getTime()).indexOf("M") == -1) {

View Full Code Here

APRIL

public static final int APRIL
Value of the MONTH field indicating the fourth month of the year.
Field Value:
3
Usages and Demos :

View More Examples of Calendar.APRIL
   1:       return "March";
   2:     case Calendar.APRIL:
   3:       return "April";
   4:         ...
   5:     default:
   6:       throw new IllegalArgumentException("'getMonth()' must be called with one of the appropriate constants in Calendar (e.g., Calendar.APRIL).");
   7:     }
   8:   }

View Full Code Here
   1:         calendar.set( Calendar.YEAR, 1743 );
   2:         calendar.set( Calendar.MONTH, Calendar.APRIL );
   3:         calendar.set( Calendar.DAY_OF_MONTH, 13 );
   4:         Date dob = calendar.getTime();

View Full Code Here
   1: 
   2:         est.setStartRule (Calendar.APRIL, 1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
   3:         est.setEndRule (Calendar.OCTOBER, -1, Calendar.SUNDAY, 2 * 60 * 60 * 1000);
   4: 
   5:         Calendar cal = new GregorianCalendar(est);

View Full Code Here
   1:       c2 = new GregorianCalendar(2000, Calendar.FEBRUARY, 26);
   2:       c1 = new GregorianCalendar(2000, Calendar.APRIL, 2);
   3:       d1 = c1.getTime();
   4:       System.out.println("Difference in Years : "
   5:                          + fieldDifference(c1, c2, Calendar.YEAR));

View Full Code Here
   1:       case Calendar.MARCH: month = "-03-"; break;
   2:       case Calendar.APRIL: month = "-04-";  break;
   3:       case Calendar.MAY: month = "-05-"; break;
   4:       case Calendar.JUNE: month = "-06-";  break;
   5:       case Calendar.JULY: month = "-07-"; break;

View Full Code Here

AUGUST

public static final int AUGUST
Value of the MONTH field indicating the eighth month of the year.
Field Value:
7
Usages and Demos :

View More Examples of Calendar.AUGUST
   1: calendar.set(Calendar.YEAR, 1990);
   2: calendar.set(Calendar.MONTH, Calendar.AUGUST);
   3: calendar.set(Calendar.DAY_OF_MONTH, 15);
   4: 
   5: calendarComponent.getCalendarView().getMonthView().setMonthViewCurrentDate(calendar.getTime());

View Full Code Here
   1:       return "July";
   2:     case Calendar.AUGUST:
   3:       return "August";
   4:     case Calendar.SEPTEMBER:
   5:       return "September";

View Full Code Here
   1:       "Jordan", "Ashworth", 
   2:       new GregorianCalendar(1989, Calendar.AUGUST, 31).getTime(), 
   3:       new Float(34567.89), new Boolean(GENDER_FEMALE)
   4:         ...
   5:       "Belle", "Spyres", 
   6:       new GregorianCalendar(1907, Calendar.AUGUST, 2).getTime(), 
   7:       new Float(567.00), new Boolean(GENDER_FEMALE)
   8:     }
   9:   };

View Full Code Here
   1:       case Calendar.JULY: month = "-07-"; break;
   2:       case Calendar.AUGUST: month = "-08-";  break;
   3:       case Calendar.SEPTEMBER: month = "-09-"; break;
   4:       case Calendar.OCTOBER: month = "-10-"; break;
   5:       case Calendar.NOVEMBER: month = "-11-";  break;

View Full Code Here
   1:             return 7;
   2:         else if (calendarMonth == Calendar.AUGUST)
   3:             return 8;
   4:         ...
   5:         else if (month == 8)
   6:            return Calendar.AUGUST;
   7:         else if (month == 9)
   8:            return Calendar.SEPTEMBER;
   9:         else if (month == 10)

View Full Code Here

DATE

public static final int DATE
Field number for get and set indicating the day of the month. This is a synonym for DAY_OF_MONTH. The first day of the month has value 1.
Field Value:
5
See Also:
DAY_OF_MONTH
Usages and Demos :

View More Examples of Calendar.DATE
   1:     private static final DateFrameable DAY_FRAMER = new FramerImpl(
   2:             Calendar.DATE);
   3: 
   4:     private static final DateFrameable MONTH_FRAMER = new FramerImpl(
   5:             Calendar.MONTH);

View Full Code Here
   1:    public static TimeInterval ONEDAY = 
   2:          new TimeInterval(Calendar.DATE,  1);
   3:    
   4:         ...
   5:             break;
   6:          case Calendar.DATE:
   7:             milis = amount * 1000 * 60 * 60 * 24;
   8:             break;
   9:          case Calendar.MONTH:

View Full Code Here
   1: 
   2:         calendar.add(Calendar.DATE, (int)days);
   3:         calendar.add(Calendar.HOUR_OF_DAY, (int)hours);
   4:         calendar.add(Calendar.MINUTE, (int)minutes);
   5:         calendar.add(Calendar.SECOND, (int)seconds);

View Full Code Here
   1:     public static final int MONTH = java.util.Calendar.MONTH;
   2:     public static final int DATE = java.util.Calendar.DATE;
   3:     public static final int YEAR = java.util.Calendar.YEAR;
   4:         ...
   5:         int m = c.get(java.util.Calendar.MONTH);
   6:         int d = c.get(java.util.Calendar.DATE);
   7:         int y = c.get(java.util.Calendar.YEAR);
   8:         ...
   9:                 break;
  10:             case java.util.Calendar.DATE :
  11:                 this.day = value;

View Full Code Here
   1:     this.spinner3 = new JSpinner(new SpinnerDateModel(new Date(), null, null, 
   2:         Calendar.DATE));
   3:         
   4:     this.spinner4 = new JSpinner(new SpinnerDateModel(new Date(), null, null, 
   5:         Calendar.YEAR));

View Full Code Here

DAY_OF_MONTH

public static final int DAY_OF_MONTH
Field number for get and set indicating the day of the month. This is a synonym for DATE. The first day of the month has value 1.
Field Value:
5
See Also:
DATE
Usages and Demos :

View More Examples of Calendar.DAY_OF_MONTH
   1:     protected int getCalendarField() {
   2:         return Calendar.DAY_OF_MONTH;
   3:     }
   4: 
   5:     protected String[] getSqlFunction(SqlGenerationContext context) {

View Full Code Here
   1:         Calendar.MILLISECOND,
   2:         Calendar.DAY_OF_MONTH,
   3:         Calendar.DAY_OF_WEEK
   4:     };

View Full Code Here
   1:     {
   2:         this(System.currentTimeMillis(), Calendar.DAY_OF_MONTH);
   3:     }
   4:         ...
   5:         set(Calendar.MILLISECOND, 0);
   6:         accuracy = Calendar.DAY_OF_MONTH;
   7:     }
   8:         ...
   9:             accuracy != Calendar.MONTH && 
  10:             accuracy != Calendar.DAY_OF_MONTH)
  11:             throw new IllegalArgumentException("Calendar accuracy must be either year, month or day: " + accuracy);

View Full Code Here
   1:     Calendar cal = Calendar.getInstance();
   2:     cal.add(Calendar.DAY_OF_MONTH, -2);
   3:     Timestamp alertRangeStart = new Timestamp(cal.getTimeInMillis());
   4:     NewsArticleList newsList = new NewsArticleList();
   5:     newsList.setForUser(userId);

View Full Code Here
   1:     int daysInMonth = cloneCalendar.getActualMaximum(
   2:           Calendar.DAY_OF_MONTH);
   3: 
   4:     for (int i = 0; i < startingDayOfMonth - 1; i++) {
   5:       jlblDay[i + 7].setForeground(Color.LIGHT_GRAY);

View Full Code Here

DAY_OF_WEEK

public static final int DAY_OF_WEEK
Field number for get and set indicating the day of the week. This field takes values SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, and SATURDAY.
Field Value:
7
Usages and Demos :

View More Examples of Calendar.DAY_OF_WEEK
   1:     Map<String, Integer> names = now.getDisplayNames(
   2:       Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
   3:     System.out.println(names);
   4:         ...
   5:     System.console().printf("%s%n", names.toString());
   6:     String name = now.getDisplayName(Calendar.DAY_OF_WEEK,
   7:       Calendar.LONG, locale);
   8:     System.console().printf("Today is a %s.%n", name);
   9:   }

View Full Code Here
   1: 
   2:         int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
   3:         ...
   4:         cal.add(Calendar.DAY_OF_WEEK, -1 * (dayOfWeek - 1));
   5:         toDayStart(cal);
   6:     }

View Full Code Here
   1:         Calendar cal = Calendar.getInstance();
   2:         cal.add(Calendar.DAY_OF_WEEK, 4);
   3:         System.out.println(cal.getTime());
   4:         ...
   5: 
   6:         assertEquals(cal.get(Calendar.DAY_OF_WEEK), Calendar.SUNDAY);
   7:         assertEquals(cal.get(Calendar.HOUR), 0);
   8:         assertEquals(cal.get(Calendar.MINUTE), 0);
   9:         assertEquals(cal.get(Calendar.SECOND), 0);

View Full Code Here
   1:     Map<String, Integer> names = now.getDisplayNames(
   2:       Calendar.DAY_OF_WEEK, Calendar.LONG, locale);
   3:     NavigableMap<String, Integer> nav = new TreeMap<String, Integer>(names);
   4:     console.printf("Whole list:%n%s%n", nav);
   5:     console.printf("First key: %s\tFirst entry: %s%n",

View Full Code Here
   1:     protected int getCalendarField() {
   2:         return Calendar.DAY_OF_WEEK;
   3:     }
   4: 
   5:     protected String[] getSqlFunction(SqlGenerationContext context) {

View Full Code Here

DAY_OF_WEEK_IN_MONTH

public static final int DAY_OF_WEEK_IN_MONTH
Field number for get and set indicating the ordinal number of the day of the week within the current month. Together with the DAY_OF_WEEK field, this uniquely specifies a day within a month. Unlike WEEK_OF_MONTH and WEEK_OF_YEAR, this field's value does not depend on getFirstDayOfWeek() or getMinimalDaysInFirstWeek(). DAY_OF_MONTH 1 through 7 always correspond to DAY_OF_WEEK_IN_MONTH 1; 8 through 14 correspond to DAY_OF_WEEK_IN_MONTH 2, and so on. DAY_OF_WEEK_IN_MONTH 0 indicates the week before DAY_OF_WEEK_IN_MONTH 1. Negative values count back from the end of the month, so the last Sunday of a month is specified as DAY_OF_WEEK = SUNDAY, DAY_OF_WEEK_IN_MONTH = -1. Because negative values count backward they will usually be aligned differently within the month than positive values. For example, if a month has 31 days, DAY_OF_WEEK_IN_MONTH -1 will overlap DAY_OF_WEEK_IN_MONTH 5 and the end of 4.
Field Value:
8
Usages and Demos :

View More Examples of Calendar.DAY_OF_WEEK_IN_MONTH
   1:       {
   2:         calendar.set(Calendar.DAY_OF_WEEK_IN_MONTH, dayOfWeekInMonth.intValue());
   3:       }
   4:       if (timeZone != null)
   5:       {

View Full Code Here
   1:     {
   2:       trySetField(calendar, Calendar.DAY_OF_WEEK_IN_MONTH, dayOfWeekInMonthField);
   3:     }
   4:     if (timeZoneField != null)
   5:     {

View Full Code Here
   1:         } else if (field.equals("dayOfWeekInMonth")) {
   2:             result = Calendar.DAY_OF_WEEK_IN_MONTH;
   3:         } else if (field.equals("amPm")) {
   4:             result = Calendar.AM_PM;
   5:         } else if (field.equals("hour")) {

View Full Code Here
   1:         } else if (field.equals("dayOfWeekInMonth")) {
   2:             result = Calendar.DAY_OF_WEEK_IN_MONTH;
   3:         } else if (field.equals("amPm")) {
   4:             result = Calendar.AM_PM;
   5:         } else if (field.equals("hour")) {

View Full Code Here
   1:             return (int)(d / HOUR_MILLIS + .5);
   2:         case Calendar.DAY_OF_WEEK_IN_MONTH :
   3:         case Calendar.DAY_OF_MONTH :
   4:             return (int) (d / DAY_MILLIS + .5);
   5:         case Calendar.WEEK_OF_YEAR :

View Full Code Here

DAY_OF_YEAR

public static final int DAY_OF_YEAR
Field number for get and set indicating the day number within the current year. The first day of the year has value 1.
Field Value:
6
Usages and Demos :

View More Examples of Calendar.DAY_OF_YEAR
   1:     protected int getCalendarField() {
   2:         return Calendar.DAY_OF_YEAR;
   3:     }
   4: 
   5:     protected String[] getSqlFunction(SqlGenerationContext context) {

View Full Code Here
   1:         Calendar.WEEK_OF_YEAR,
   2:         Calendar.DAY_OF_YEAR,
   3:         Calendar.HOUR_OF_DAY,
   4:         Calendar.MINUTE,
   5:         Calendar.SECOND,

View Full Code Here
   1:         year0 = c0.get(Calendar.YEAR);
   2:         day0 = c0.get(Calendar.DAY_OF_YEAR);
   3:         year1 = c1.get(Calendar.YEAR);
   4:         ...
   5:         day1 = c1.get(Calendar.DAY_OF_YEAR);
   6: 
   7:         ...
   8:             c.set(year0, 11, 31);
   9:             days = c.get(Calendar.DAY_OF_YEAR) - day0;
  10:             for (int i = year0 + 1; i < year1; i++){

View Full Code Here
   1:         {
   2:             cal.add(Calendar.DAY_OF_YEAR,-1);    
   3:             break;
   4:         }
   5:         case OneWeek:

View Full Code Here
   1:     long startTime = startCalendar.getTime().getTime();
   2:     if (intervalUnits == Calendar.DAY_OF_YEAR) {
   3:       numberOfIntervals = 
   4:         ...
   5:     if (numberOfIntervals > MIN_INTERVALS) {
   6:       intervalUnits = Calendar.DAY_OF_YEAR;
   7:       return;
   8:         ...
   9:     int labelUnits = intervalUnits;
  10:     if (labelUnits == Calendar.DAY_OF_YEAR)
  11:     for (int i = 0; i < numberOfIntervals; i++) {

View Full Code Here

DECEMBER

public static final int DECEMBER
Value of the MONTH field indicating the twelfth month of the year.
Field Value:
11
Usages and Demos :

View More Examples of Calendar.DECEMBER
   1:       return "November";
   2:     case Calendar.DECEMBER:
   3:       return "December";
   4:     default:
   5:       throw new IllegalArgumentException("'getMonth()' must be called with one of the appropriate constants in Calendar (e.g., Calendar.APRIL).");

View Full Code Here
   1:     data.add(new TableLine("First Event", calendar.getTime()));
   2:     calendar.set(1989, Calendar.DECEMBER, 22);
   3:     data.add(new TableLine("Second Event", calendar.getTime()));
   4:     calendar.set(1995, Calendar.MARCH, 23);
   5:     data.add(new TableLine("Third Event", calendar.getTime()));

View Full Code Here
   1:     data.add(new TableLine("First Event", calendar.getTime()));
   2:     calendar.set(1989, Calendar.DECEMBER, 22);
   3:     data.add(new TableLine("Second Event", calendar.getTime()));
   4:     calendar.set(1995, Calendar.MARCH, 23);
   5:     data.add(new TableLine("Third Event", calendar.getTime()));

View Full Code Here
   1:       case Calendar.NOVEMBER: month = "-11-";  break;
   2:       case Calendar.DECEMBER: month = "-12-";  break;
   3:       default: month = "-NA-"; break;
   4:       }
   5:       sbuf.append(month);

View Full Code Here

DST_OFFSET

public static final int DST_OFFSET
Field number for get and set indicating the daylight savings offset in milliseconds.

This field reflects the correct daylight saving offset value of the time zone of this Calendar if the TimeZone implementation subclass supports historical Daylight Saving Time schedule changes.

Field Value:
16
Usages and Demos :

View More Examples of Calendar.DST_OFFSET
   1:     public int getDSTOffset() {
   2:     return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
   3:     }
   4: 
   5:     

View Full Code Here
   1:     public int getDSTOffset() {
   2:     return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
   3:     }
   4: 
   5:     

View Full Code Here
   1:     public int getDSTOffset() {
   2:     return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
   3:     }
   4: 
   5:     

View Full Code Here
   1:     public int getDSTOffset() {
   2:     return calendar.get(Calendar.DST_OFFSET)/(60*60*1000);
   3:     }
   4: 
   5:     

View Full Code Here
   1:         int offset = calendar.get(Calendar.ZONE_OFFSET) +
   2:             calendar.get(Calendar.DST_OFFSET);
   3:         StringBuffer buf = new StringBuffer();
   4:         if (offset < 0) {
   5:             buf.append("-");

View Full Code Here

ERA

public static final int ERA
Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar. This is a calendar-specific value; see subclass documentation.
Field Value:
0
Usages and Demos :

View More Examples of Calendar.ERA
   1:             c.get(Calendar.YEAR) + " " +
   2:             c.get(Calendar.ERA));
   3:     }
   4: }

View Full Code Here
   1:     Map<String, Integer> names = now.getDisplayNames(
   2:       Calendar.ERA, Calendar.LONG, locale);
   3:     console.printf("%s%n", names);
   4:     console.printf("It is year %tY of the current era%n", now);
   5:     console.printf("The calendar class is: %s%n", now.getClass().getName());

View Full Code Here
   1:         int offset = tz.getOffset(
   2:             c.get(Calendar.ERA), 
   3:             c.get(Calendar.YEAR),
   4:             c.get(Calendar.MONTH), 
   5:             c.get(Calendar.DAY_OF_MONTH), 

View Full Code Here
   1:         synchronized (calendar) {
   2:             if (calendar.get(Calendar.ERA) == GregorianCalendar.BC) {
   3:                 buf.append("-");
   4:         ...
   5:                 calendar.setTime(date);
   6:                 calendar.set(Calendar.ERA, GregorianCalendar.AD);
   7:                 date = calendar.getTime();
   8:             }
   9:             buf.append(ZULU.format(date));

View Full Code Here
   1:                         if (bc) {
   2:                 calendar.set(Calendar.ERA, GregorianCalendar.BC);
   3:             }
   4:             calendar.setTime(result);
   5:         }

View Full Code Here

FEBRUARY

public static final int FEBRUARY
Value of the MONTH field indicating the second month of the year.
Field Value:
1
Usages and Demos :

View More Examples of Calendar.FEBRUARY
   1:       return "January";
   2:     case Calendar.FEBRUARY:
   3:       return "February";
   4:     case Calendar.MARCH:
   5:       return "March";

View Full Code Here
   1:       "Clay", "Ashworth", 
   2:       new GregorianCalendar(1962, Calendar.FEBRUARY, 20).getTime(), 
   3:       new Float(12345.67), new Boolean(GENDER_MALE)
   4:     }, {
   5:       "Jacob", "Ashworth", 

View Full Code Here
   1:    {
   2:       c2 = new GregorianCalendar(2000, Calendar.FEBRUARY, 26);
   3:       c1 = new GregorianCalendar(2000, Calendar.APRIL, 2);
   4:       d1 = c1.getTime();
   5:       System.out.println("Difference in Years : "

View Full Code Here
   1:       case Calendar.JANUARY: month = "-01-"; break;
   2:       case Calendar.FEBRUARY: month = "-02-";  break;
   3:       case Calendar.MARCH: month = "-03-"; break;
   4:       case Calendar.APRIL: month = "-04-";  break;
   5:       case Calendar.MAY: month = "-05-"; break;

View Full Code Here
   1:             return 1;
   2:         else if (calendarMonth == Calendar.FEBRUARY)
   3:             return 2;
   4:         ...
   5:         else if (month == 2)
   6:            return Calendar.FEBRUARY;
   7:         else if (month == 3)
   8:            return Calendar.MARCH;
   9:         else if (month == 4)

View Full Code Here

FIELD_COUNT

public static final int FIELD_COUNT
The number of distinct fields recognized by get and set. Field numbers range from 0..FIELD_COUNT-1.
Field Value:
17

FRIDAY

public static final int FRIDAY
Value of the DAY_OF_WEEK field indicating Friday.
Field Value:
6
Usages and Demos :

View More Examples of Calendar.FRIDAY
   1:       return "Thursday";
   2:     case Calendar.FRIDAY:
   3:       return "Friday";
   4:     case Calendar.SATURDAY:
   5:       return "Saturday";

View Full Code Here
   1:                 return("Thursday");
   2:             case Calendar.FRIDAY:
   3:                 return("Friday");
   4:         ...
   5:                 return(4);
   6:             case Calendar.FRIDAY:
   7:                 return(5);
   8:             case Calendar.SATURDAY:
   9:                 return(6);

View Full Code Here
   1:     if("TH".equals(day)){return Calendar.THURSDAY;}
   2:     if("FR".equals(day)){return Calendar.FRIDAY;}
   3:     if("SA".equals(day)){return Calendar.SATURDAY;}
   4:         ...
   5:     if(Calendar.THURSDAY==day){return "TH";}
   6:     if(Calendar.FRIDAY==day){return "FR";}
   7:     if(Calendar.SATURDAY==day){return "SA";}
   8:     throw new IllegalArgumentException("  ERROR: "+day+" is not a valid week day number");
   9:   }

View Full Code Here
   1:                            break;
   2:                        case Calendar.FRIDAY:
   3:                            cal.add(Calendar.DAY_OF_MONTH, -4);
   4:                            startDate = cal.getTime();
   5:                            break;

View Full Code Here
   1:                     insets.top+3*fm.getHeight ());
   2:       g.drawString (weekdayNames [Calendar.FRIDAY], insets.left+5*fieldWidth+
   3:                     (fieldWidth-
   4:         ...
   5:                     fm.stringWidth (weekdayNames [Calendar.FRIDAY]))/2,
   6:                     insets.top+3*fm.getHeight ());
   7:         ...
   8: 
   9:          case Calendar.FRIDAY: col = 5; break;

View Full Code Here

HOUR

public static final int HOUR
Field number for get and set indicating the hour of the morning or afternoon. HOUR is used for the 12-hour clock (0 - 11). Noon and midnight are represented by 0, not by 12. E.g., at 10:04:15.250 PM the HOUR is 10.
Field Value:
10
See Also:
AM_PM, HOUR_OF_DAY
Usages and Demos :

View More Examples of Calendar.HOUR
   1:     public static void toDayStart(final Calendar cal) {
   2:         cal.add(Calendar.HOUR, -1 * cal.get(Calendar.HOUR_OF_DAY));
   3:         cal.add(Calendar.MINUTE, -1 * cal.get(Calendar.MINUTE));
   4:         cal.add(Calendar.SECOND, -1 * cal.get(Calendar.SECOND));
   5:         cal.add(Calendar.MILLISECOND, -1 * cal.get(Calendar.MILLISECOND));

View Full Code Here
   1: 
   2:     cal.add(Calendar.HOUR, -4);
   3:     System.out.println(df.format(cal.getTime()));
   4: 
   5:     cal.add(Calendar.AM_PM, 1);

View Full Code Here
   1:     private static final DateFrameable HOUR_FRAMER = new FramerImpl(
   2:             Calendar.HOUR);
   3: 
   4:     private static final DateFrameable MINUTE_FRAMER = new FramerImpl(
   5:             Calendar.MINUTE);

View Full Code Here
   1:             break;
   2:          case Calendar.HOUR:
   3:          case Calendar.HOUR_OF_DAY:
   4:             milis = amount * 1000 * 60 * 60;
   5:             break;

View Full Code Here
   1:     if("MINUTELY".equals(freq)){return Calendar.MINUTE;}
   2:     if("HOURLY".equals(freq)){return Calendar.HOUR;}
   3:     if("DAILY".equals(freq)){return Calendar.DAY_OF_MONTH;}
   4:     if("WEEKLY".equals(freq)){return Calendar.WEEK_OF_YEAR;}
   5:     if("MONTHLY".equals(freq)){return Calendar.MONTH;}

View Full Code Here

HOUR_OF_DAY

public static final int HOUR_OF_DAY
Field number for get and set indicating the hour of the day. HOUR_OF_DAY is used for the 24-hour clock. E.g., at 10:04:15.250 PM the HOUR_OF_DAY is 22.
Field Value:
11
See Also:
HOUR
Usages and Demos :

View More Examples of Calendar.HOUR_OF_DAY
   1:     public static void toDayStart(final Calendar cal) {
   2:         cal.add(Calendar.HOUR, -1 * cal.get(Calendar.HOUR_OF_DAY));
   3:         cal.add(Calendar.MINUTE, -1 * cal.get(Calendar.MINUTE));
   4:         cal.add(Calendar.SECOND, -1 * cal.get(Calendar.SECOND));
   5:         cal.add(Calendar.MILLISECOND, -1 * cal.get(Calendar.MILLISECOND));

View Full Code Here
   1:         Calendar.DAY_OF_YEAR,
   2:         Calendar.HOUR_OF_DAY,
   3:         Calendar.MINUTE,
   4:         Calendar.SECOND,
   5:         Calendar.MILLISECOND,

View Full Code Here
   1:          case Calendar.HOUR:
   2:          case Calendar.HOUR_OF_DAY:
   3:             milis = amount * 1000 * 60 * 60;
   4:             break;
   5:          case Calendar.DATE:

View Full Code Here
   1:     static int diffHour(Calendar c0, Calendar c1){
   2:         return diffDay(c0, c1) * 24 + c1.get(Calendar.HOUR_OF_DAY) - c0.get(Calendar.HOUR_OF_DAY);
   3:     }
   4:         ...
   5:             return new Integer(diffDay(c0, c1));
   6:         case Calendar.HOUR_OF_DAY:
   7:             return new Integer(diffHour(c0, c1));
   8:         case Calendar.MINUTE:
   9:             return new Integer(diffMinute(c0, c1));

View Full Code Here
   1:         calendar.add(Calendar.DATE, (int)days);
   2:         calendar.add(Calendar.HOUR_OF_DAY, (int)hours);
   3:         calendar.add(Calendar.MINUTE, (int)minutes);
   4:         calendar.add(Calendar.SECOND, (int)seconds);
   5:         calendar.add(Calendar.MILLISECOND, (int)milliseconds);

View Full Code Here

JANUARY

public static final int JANUARY
Value of the MONTH field indicating the first month of the year.
Field Value:
0
Usages and Demos :

View More Examples of Calendar.JANUARY
   1:     switch (month) {
   2:     case Calendar.JANUARY:
   3:       return "January";
   4:     case Calendar.FEBRUARY:
   5:       return "February";

View Full Code Here
   1:       switch(calendar.get(Calendar.MONTH)) {
   2:       case Calendar.JANUARY: month = "-01-"; break;
   3:       case Calendar.FEBRUARY: month = "-02-";  break;
   4:       case Calendar.MARCH: month = "-03-"; break;
   5:       case Calendar.APRIL: month = "-04-";  break;

View Full Code Here
   1:         Calendar calendar = getGMTCalendar();
   2:         calendar.set(1601, Calendar.JANUARY, 1, 0, 0, 0);
   3:         calendar.set(Calendar.MILLISECOND, 0);
   4: 
   5:         calendar.add(Calendar.DATE, (int)days);

View Full Code Here
   1:                 buf,
   2:                 c.get(Calendar.MONTH) - Calendar.JANUARY + 1);
   3:             buf.append('-');
   4:         ...
   5:                     - 1
   6:                     + Calendar.JANUARY);
   7:             c.set(
   8:                 Calendar.DAY_OF_MONTH,
   9:                 Integer.parseInt(text.substring(8, 10)));

View Full Code Here
   1: 
   2:         if (calendarMonth == Calendar.JANUARY)
   3:             return 1;
   4:         ...
   5:         if (month == 1)
   6:            return Calendar.JANUARY;
   7:         else if (month == 2)
   8:         ...
   9:         else
  10:            return Calendar.JANUARY;

View Full Code Here

JULY

public static final int JULY
Value of the MONTH field indicating the seventh month of the year.
Field Value:
6
Usages and Demos :

View More Examples of Calendar.JULY
   1:       return "June";
   2:     case Calendar.JULY:
   3:       return "July";
   4:     case Calendar.AUGUST:
   5:       return "August";

View Full Code Here
   1:         startCalendar.clear();
   2:         startCalendar.set(2006, Calendar.JULY, 3);
   3:         endCalendar = Calendar.getInstance();
   4:         ...
   5:         endCalendar.clear();
   6:         endCalendar.set(2006, Calendar.JULY, 7);
   7:     }
   8: 
   9:     public void testInvokeInternal() throws Exception {

View Full Code Here
   1:       case Calendar.JUNE: month = "-06-";  break;
   2:       case Calendar.JULY: month = "-07-"; break;
   3:       case Calendar.AUGUST: month = "-08-";  break;
   4:       case Calendar.SEPTEMBER: month = "-09-"; break;
   5:       case Calendar.OCTOBER: month = "-10-"; break;

View Full Code Here
   1:             return 6;
   2:         else if (calendarMonth == Calendar.JULY)
   3:             return 7;
   4:         ...
   5:         else if (month == 7)
   6:            return Calendar.JULY;
   7:         else if (month == 8)
   8:            return Calendar.AUGUST;
   9:         else if (month == 9)

View Full Code Here
   1:     
   2:     tmpCal.set(theYear, Calendar.JULY, 1);
   3:     dayOfWeek = tmpCal.get(Calendar.DAY_OF_WEEK);
   4:     if (tmpCal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
   5:       tmpCal.add(Calendar.DATE, 1);

View Full Code Here

JUNE

public static final int JUNE
Value of the MONTH field indicating the sixth month of the year.
Field Value:
5
Usages and Demos :

View More Examples of Calendar.JUNE
   1:       return "May";
   2:     case Calendar.JUNE:
   3:       return "June";
   4:     case Calendar.JULY:
   5:       return "July";

View Full Code Here
   1:         cal.set(Calendar.MILLISECOND, 0);
   2:         cal.set(2004, Calendar.JUNE, 5, 16, 10, 32);
   3:         Date date = cal.getTime();
   4:         ...
   5:         cal.set(Calendar.MILLISECOND, 0);
   6:         cal.set(2004, Calendar.JUNE, 5, 16, 10, 32);
   7:         Date date = cal.getTime();
   8:         assertEquals(date, entries[0].getDate());
   9:     }

View Full Code Here
   1:       case Calendar.MAY: month = "-05-"; break;
   2:       case Calendar.JUNE: month = "-06-";  break;
   3:       case Calendar.JULY: month = "-07-"; break;
   4:       case Calendar.AUGUST: month = "-08-";  break;
   5:       case Calendar.SEPTEMBER: month = "-09-"; break;

View Full Code Here
   1:             return 5;
   2:         else if (calendarMonth == Calendar.JUNE)
   3:             return 6;
   4:         ...
   5:         else if (month == 6)
   6:            return Calendar.JUNE;
   7:         else if (month == 7)
   8:            return Calendar.JULY;
   9:         else if (month == 8)

View Full Code Here

MARCH

public static final int MARCH
Value of the MONTH field indicating the third month of the year.
Field Value:
2
Usages and Demos :

View More Examples of Calendar.MARCH
   1:     cal.set( Calendar.DATE, 1 );
   2:     cal.set( Calendar.MONTH, Calendar.MARCH );
   3:     cal.set( Calendar.YEAR, 1973 );
   4:  
   5:     System.out.println( "So Mo Di Mi Do Fr Sa" );

View Full Code Here
   1:     cal.set( Calendar.DATE, 12 );
   2:     cal.set( Calendar.MONTH, Calendar.MARCH );
   3:     cal.set( Calendar.YEAR, 1973 );
   4:     printCalendar( cal );
   5:   }

View Full Code Here
   1:       return "February";
   2:     case Calendar.MARCH:
   3:       return "March";
   4:     case Calendar.APRIL:
   5:       return "April";

View Full Code Here
   1:         calendar.set(Calendar.YEAR, 2002);
   2:         calendar.set(Calendar.MONTH, Calendar.MARCH);
   3:         calendar.set(Calendar.DAY_OF_MONTH, 22);
   4:         calendar.set(Calendar.HOUR_OF_DAY, 11);
   5:         calendar.set(Calendar.MINUTE, 30);

View Full Code Here
   1:       case Calendar.FEBRUARY: month = "-02-";  break;
   2:       case Calendar.MARCH: month = "-03-"; break;
   3:       case Calendar.APRIL: month = "-04-";  break;
   4:       case Calendar.MAY: month = "-05-"; break;
   5:       case Calendar.JUNE: month = "-06-";  break;

View Full Code Here

MAY

public static final int MAY
Value of the MONTH field indicating the fifth month of the year.
Field Value:
4
Usages and Demos :

View More Examples of Calendar.MAY
   1:       return "April";
   2:     case Calendar.MAY:
   3:       return "May";
   4:     case Calendar.JUNE:
   5:       return "June";

View Full Code Here
   1:         Calendar calendar1 = new GregorianCalendar();
   2:         calendar1.set(Calendar.MONTH, Calendar.MAY);
   3:         calendar1.set(Calendar.DAY_OF_MONTH, 19);
   4:         ...
   5:         Calendar calendar2 = new GregorianCalendar();
   6:         calendar2.set(Calendar.MONTH, Calendar.MAY);
   7:         calendar2.set(Calendar.DAY_OF_MONTH, 19);
   8:         calendar2.set(Calendar.YEAR, 1980);
   9:         calendar2.set(Calendar.HOUR_OF_DAY, 0);

View Full Code Here
   1:       case Calendar.APRIL: month = "-04-";  break;
   2:       case Calendar.MAY: month = "-05-"; break;
   3:       case Calendar.JUNE: month = "-06-";  break;
   4:       case Calendar.JULY: month = "-07-"; break;
   5:       case Calendar.AUGUST: month = "-08-";  break;

View Full Code Here
   1:             return 4;
   2:         else if (calendarMonth == Calendar.MAY)
   3:             return 5;
   4:         ...
   5:         else if (month == 5)
   6:            return Calendar.MAY;
   7:         else if (month == 6)
   8:            return Calendar.JUNE;
   9:         else if (month == 7)

View Full Code Here
   1:     
   2:     tmpCal.set(theYear, Calendar.MAY, 25);
   3:     dayOfWeek = tmpCal.get(Calendar.DAY_OF_WEEK);
   4:     if (tmpCal.get(Calendar.DAY_OF_WEEK) == Calendar.MONDAY) {
   5:       tmpCal.add(Calendar.DATE, -7);

View Full Code Here

MILLISECOND

public static final int MILLISECOND
Field number for get and set indicating the millisecond within the second. E.g., at 10:04:15.250 PM the MILLISECOND is 250.
Field Value:
14
Usages and Demos :

View More Examples of Calendar.MILLISECOND
   1:         Calendar.SECOND,
   2:         Calendar.MILLISECOND,
   3:         Calendar.DAY_OF_MONTH,
   4:         Calendar.DAY_OF_WEEK
   5:     };

View Full Code Here
   1:         cal.setTime( since );
   2:         cal.add( Calendar.MILLISECOND, 
   3:                  (cal.get( Calendar.ZONE_OFFSET ) + 
   4:                   (cal.getTimeZone().inDaylightTime( since ) ? cal.get( Calendar.DST_OFFSET ) : 0 )) );

View Full Code Here
   1:         c.setTime(adjusted);
   2:         c.add(Calendar.MILLISECOND, -1);
   3:         assertEquals("Unexpected day of week", Calendar.SUNDAY, c
   4:         ...
   5:                 .get(Calendar.DAY_OF_WEEK));
   6:         c.add(Calendar.MILLISECOND, -1);
   7:         assertEquals("Unexpected day of week", Calendar.SUNDAY, c
   8:                 .get(Calendar.DAY_OF_WEEK));
   9:     }

View Full Code Here
   1:       {
   2:          case Calendar.MILLISECOND:
   3:             milis = amount;
   4:             break;
   5:          case Calendar.SECOND:

View Full Code Here
   1:         Calendar date = Calendar.getInstance();
   2:         date.set( Calendar.MILLISECOND, 0 );
   3:         date.set( Calendar.SECOND, 0 );
   4:         ...
   5:         Calendar date = DateUtils.getFirstDate( theOffsetInDays + 1 );
   6:         date.add( Calendar.MILLISECOND, -1 );
   7:         return date;
   8:     }

View Full Code Here

MINUTE

public static final int MINUTE
Field number for get and set indicating the minute within the hour. E.g., at 10:04:15.250 PM the MINUTE is 4.
Field Value:
12
Usages and Demos :

View More Examples of Calendar.MINUTE
   1:         Calendar.HOUR_OF_DAY,
   2:         Calendar.MINUTE,
   3:         Calendar.SECOND,
   4:         Calendar.MILLISECOND,
   5:         Calendar.DAY_OF_MONTH,

View Full Code Here
   1:     private static final DateFrameable MINUTE_FRAMER = new FramerImpl(
   2:             Calendar.MINUTE);
   3: 
   4:         ...
   5:         ourUnit2field.put(HOUR, new Integer(Calendar.HOUR_OF_DAY));
   6:         ourUnit2field.put(MINUTE, new Integer(Calendar.MINUTE));
   7:         ourUnit2field.put(SECOND, new Integer(Calendar.SECOND));
   8:     }

View Full Code Here
   1:             break;
   2:          case Calendar.MINUTE:
   3:             milis = amount * 1000 * 60;
   4:             break;
   5:          case Calendar.HOUR:

View Full Code Here
   1:     static int diffMinute(Calendar c0, Calendar c1){
   2:         return diffHour(c0, c1) * 60 + c1.get(Calendar.MINUTE) - c0.get(Calendar.MINUTE);
   3:     }
   4:         ...
   5:             return new Integer(diffHour(c0, c1));
   6:         case Calendar.MINUTE:
   7:             return new Integer(diffMinute(c0, c1));
   8:         case Calendar.SECOND: {
   9:             long l = diffSecond(c0, c1);

View Full Code Here
   1:         calendar.add(Calendar.HOUR_OF_DAY, (int)hours);
   2:         calendar.add(Calendar.MINUTE, (int)minutes);
   3:         calendar.add(Calendar.SECOND, (int)seconds);
   4:         calendar.add(Calendar.MILLISECOND, (int)milliseconds);

View Full Code Here

MONDAY

public static final int MONDAY
Value of the DAY_OF_WEEK field indicating Monday.
Field Value:
2
Usages and Demos :

View More Examples of Calendar.MONDAY
   1:     switch (day) {
   2:     case Calendar.MONDAY:
   3:       return "Monday";
   4:     case Calendar.TUESDAY:
   5:       return "Tuesday";

View Full Code Here
   1:         c.setTime(adjustedMonday);
   2:         assertEquals("Unexpected day of week", Calendar.MONDAY, c
   3:                 .get(Calendar.DAY_OF_WEEK));
   4:         ...
   5:         assertTrue("Unexpected day of week, date=" + c.getTime(),
   6:                 Calendar.MONDAY == c.get(Calendar.DAY_OF_WEEK));
   7:         assertNotSame(adjustedMonday, newMonday());
   8:         c.setTime(adjustedSunday);
   9:         assertEquals("Unexpected day of week, date=" + c.getTime(),

View Full Code Here
   1:                 return("Sunday");
   2:             case Calendar.MONDAY:
   3:                 return("Monday");
   4:         ...
   5:                 return(0);
   6:             case Calendar.MONDAY:
   7:                 return(1);
   8:             case Calendar.TUESDAY:
   9:                 return(2);

View Full Code Here
   1:     if("SU".equals(day)){return Calendar.SUNDAY;}
   2:     if("MO".equals(day)){return Calendar.MONDAY;}
   3:     if("TU".equals(day)){return Calendar.TUESDAY;}
   4:         ...
   5:     if(Calendar.SUNDAY==day){return "SU";}
   6:     if(Calendar.MONDAY==day){return "MO";}
   7:     if(Calendar.TUESDAY==day){return "TU";}
   8:     if(Calendar.WEDNESDAY==day){return "WE";}
   9:     if(Calendar.THURSDAY==day){return "TH";}

View Full Code Here
   1:                            break;
   2:                        case Calendar.MONDAY:
   3:                            startDate = cal.getTime();
   4:                            break;
   5:                        case Calendar.TUESDAY:

View Full Code Here

MONTH

public static final int MONTH
Field number for get and set indicating the month. This is a calendar-specific value. The first month of the year is JANUARY which is 0; the last depends on the number of months in a year.
Field Value:
2
Usages and Demos :

View More Examples of Calendar.MONTH
   1:         Calendar.YEAR,
   2:         Calendar.MONTH,
   3:         Calendar.WEEK_OF_YEAR,
   4:         Calendar.DAY_OF_YEAR,
   5:         Calendar.HOUR_OF_DAY,

View Full Code Here
   1:     final Map<String, Integer> names = now.getDisplayNames(
   2:         Calendar.MONTH, Calendar.ALL_STYLES, locale);
   3:     console.printf("Starting names: %s%n", names);
   4:     final Deque<String> deque = new LinkedBlockingDeque<String>(6);
   5:     try {

View Full Code Here
   1:         set(Calendar.MILLISECOND, 0);
   2:         accuracy = Calendar.MONTH;
   3:     }
   4:         ...
   5:         if (accuracy != Calendar.YEAR && 
   6:             accuracy != Calendar.MONTH && 
   7:             accuracy != Calendar.DAY_OF_MONTH)
   8:         ...
   9:             case Calendar.YEAR:
  10:                 set(Calendar.MONTH, 0);
  11:             case Calendar.MONTH:

View Full Code Here
   1:     private static final DateFrameable MONTH_FRAMER = new FramerImpl(
   2:             Calendar.MONTH);
   3: 
   4:     private static final DateFrameable HOUR_FRAMER = new FramerImpl(
   5:             Calendar.HOUR);

View Full Code Here
   1:             break;
   2:          case Calendar.MONTH:
   3:             milis = amount * 1000 * 60 * 60 * 24 * 30;
   4:             break;
   5:       }

View Full Code Here

NOVEMBER

public static final int NOVEMBER
Value of the MONTH field indicating the eleventh month of the year.
Field Value:
10
Usages and Demos :

View More Examples of Calendar.NOVEMBER
   1:       return "October";
   2:     case Calendar.NOVEMBER:
   3:       return "November";
   4:     case Calendar.DECEMBER:
   5:       return "December";

View Full Code Here
   1:         c.set(Calendar.YEAR, 2004);
   2:         c.set(Calendar.MONTH, Calendar.NOVEMBER);
   3:         c.set(Calendar.DAY_OF_MONTH, 8);
   4:         ...
   5:         c.set(Calendar.YEAR, 2004);
   6:         c.set(Calendar.MONTH, Calendar.NOVEMBER);
   7:         c.set(Calendar.DAY_OF_MONTH, 14);
   8:         return c.getTime();

View Full Code Here
   1:         nov22nd2001 = Calendar.getInstance();
   2:         nov22nd2001.set(2001, Calendar.NOVEMBER, 22, 10, 01, 01);
   3: 
   4:     }

View Full Code Here
   1:       case Calendar.OCTOBER: month = "-10-"; break;
   2:       case Calendar.NOVEMBER: month = "-11-";  break;
   3:       case Calendar.DECEMBER: month = "-12-";  break;
   4:       default: month = "-NA-"; break;
   5:       }

View Full Code Here
   1:         cal = Calendar.getInstance();
   2:         cal.set(2001, Calendar.NOVEMBER, 22, 10, 01, 01);
   3:         cal2 = Calendar.getInstance();
   4:         ...
   5:         cal2.set(2001, Calendar.NOVEMBER, 22, 11, 01, 01);
   6:     }
   7: 
   8:     public void testGetTimeFromDate() {

View Full Code Here

OCTOBER

public static final int OCTOBER
Value of the MONTH field indicating the tenth month of the year.
Field Value:
9
Usages and Demos :

View More Examples of Calendar.OCTOBER
   1:     License l = new License();
   2:     l.setExpirationDate(new GregorianCalendar(2010, Calendar.OCTOBER, 31));
   3:     
   4:     URL resource = LicenseUtility.class.getResource("license.file");
   5:     

View Full Code Here
   1:       return "September";
   2:     case Calendar.OCTOBER:
   3:       return "October";
   4:     case Calendar.NOVEMBER:
   5:       return "November";

View Full Code Here
   1:                 Calendar cal = Calendar.getInstance();
   2:                 cal.set(Integer.parseInt(date),Calendar.OCTOBER,1);
   3:                 date = this.getDateFormat().format(cal.getTime());
   4:             }
   5:             if (date!=null){

View Full Code Here
   1:       case Calendar.SEPTEMBER: month = "-09-"; break;
   2:       case Calendar.OCTOBER: month = "-10-"; break;
   3:       case Calendar.NOVEMBER: month = "-11-";  break;
   4:       case Calendar.DECEMBER: month = "-12-";  break;
   5:       default: month = "-NA-"; break;

View Full Code Here
   1:             return 9;
   2:         else if (calendarMonth == Calendar.OCTOBER)
   3:             return 10;
   4:         ...
   5:         else if (month == 10)
   6:            return Calendar.OCTOBER;
   7:         else if (month == 11)
   8:            return Calendar.NOVEMBER;
   9:         else if (month == 12)

View Full Code Here

PM

public static final int PM
Value of the AM_PM field indicating the period of the day from noon to just before midnight.
Field Value:
1
Usages and Demos :

View More Examples of Calendar.PM
   1:   public String getAmPm() {
   2:     return (this.time == null || this.mc.get(Calendar.AM_PM) == Calendar.PM) ? 
   3:       "pm" : "am";
   4:   }
   5: }

View Full Code Here
   1:     select.addItem(Calendar.AM, "AM");
   2:     select.addItem(Calendar.PM, "PM");
   3:     return select;
   4:   }
   5: }

View Full Code Here
   1:     calendar.set(Calendar.MINUTE, 59);
   2:     calendar.set(Calendar.AM_PM, Calendar.PM);
   3:     calendar.set(Calendar.SECOND, 59);
   4:      calendar.set(Calendar.MILLISECOND, 999);
   5:         calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

View Full Code Here
   1:     calendar.set(Calendar.MINUTE, 59);
   2:     calendar.set(Calendar.AM_PM, Calendar.PM);
   3:     calendar.set(Calendar.SECOND, 59);
   4:      calendar.set(Calendar.MILLISECOND, 999);
   5:         calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

View Full Code Here
   1:         cal.set(Calendar.MINUTE, 0);
   2:         cal.set(Calendar.AM_PM, Calendar.PM);
   3:       }
   4:       hour = cal.get(Calendar.HOUR);
   5:       minute = cal.get(Calendar.MINUTE);

View Full Code Here

SATURDAY

public static final int SATURDAY
Value of the DAY_OF_WEEK field indicating Saturday.
Field Value:
7
Usages and Demos :

View More Examples of Calendar.SATURDAY
   1:       return "Friday";
   2:     case Calendar.SATURDAY:
   3:       return "Saturday";
   4:     case Calendar.SUNDAY:
   5:       return "Sunday";

View Full Code Here
   1:                 return("Friday");
   2:             case Calendar.SATURDAY:
   3:                 return("Saturday");
   4:         ...
   5:                 return(5);
   6:             case Calendar.SATURDAY:
   7:                 return(6);
   8:             default:
   9:                 return(-1);

View Full Code Here
   1:     if("FR".equals(day)){return Calendar.FRIDAY;}
   2:     if("SA".equals(day)){return Calendar.SATURDAY;}
   3:     throw new IllegalArgumentException("  ERROR: "+day+" is not a valid week day");
   4:         ...
   5:     if(Calendar.FRIDAY==day){return "FR";}
   6:     if(Calendar.SATURDAY==day){return "SA";}
   7:     throw new IllegalArgumentException("  ERROR: "+day+" is not a valid week day number");
   8:   }
   9: }

View Full Code Here
   1:                            break;
   2:                        case Calendar.SATURDAY:
   3:                            cal.add(Calendar.DAY_OF_MONTH, -5);
   4:                            startDate = cal.getTime();
   5:                            break;

View Full Code Here
   1:                     insets.top+3*fm.getHeight ());
   2:       g.drawString (weekdayNames [Calendar.SATURDAY], insets.left+6*
   3:                     fieldWidth+(fieldWidth-
   4:         ...
   5:                     fm.stringWidth (weekdayNames [Calendar.SATURDAY]))/2,
   6:                     insets.top+3*fm.getHeight ());
   7:         ...
   8: 
   9:          case Calendar.SATURDAY: col = 6;
  10:       }

View Full Code Here

SECOND

public static final int SECOND
Field number for get and set indicating the second within the minute. E.g., at 10:04:15.250 PM the SECOND is 15.
Field Value:
13
Usages and Demos :

View More Examples of Calendar.SECOND
   1:         Calendar.MINUTE,
   2:         Calendar.SECOND,
   3:         Calendar.MILLISECOND,
   4:         Calendar.DAY_OF_MONTH,
   5:         Calendar.DAY_OF_WEEK

View Full Code Here
   1:     private static final DateFrameable SECOND_FRAMER = new FramerImpl(
   2:             Calendar.SECOND);
   3: 
   4:         ...
   5:         ourUnit2field.put(MINUTE, new Integer(Calendar.MINUTE));
   6:         ourUnit2field.put(SECOND, new Integer(Calendar.SECOND));
   7:     }
   8: 
   9:     public GregorianTimeUnitStack() {

View Full Code Here
   1:             break;
   2:          case Calendar.SECOND:
   3:             milis = amount * 1000;
   4:             break;
   5:          case Calendar.MINUTE:

View Full Code Here
   1:     static long diffSecond(Calendar c0, Calendar c1){
   2:         return diffMinute(c0, c1) * 60L + c1.get(Calendar.SECOND) - c0.get(Calendar.SECOND);
   3:     }    
   4:         ...
   5:             return new Integer(diffMinute(c0, c1));
   6:         case Calendar.SECOND: {
   7:             long l = diffSecond(c0, c1);
   8:             if (l > Integer.MAX_VALUE || l < Integer.MIN_VALUE){
   9:                 return new Long(l);

View Full Code Here
   1:         calendar.add(Calendar.MINUTE, (int)minutes);
   2:         calendar.add(Calendar.SECOND, (int)seconds);
   3:         calendar.add(Calendar.MILLISECOND, (int)milliseconds);
   4: 
   5:         return calendar.getTime();

View Full Code Here

SEPTEMBER

public static final int SEPTEMBER
Value of the MONTH field indicating the ninth month of the year.
Field Value:
8
Usages and Demos :

View More Examples of Calendar.SEPTEMBER
   1:       return "August";
   2:     case Calendar.SEPTEMBER:
   3:       return "September";
   4:     case Calendar.OCTOBER:
   5:       return "October";

View Full Code Here
   1:       case Calendar.AUGUST: month = "-08-";  break;
   2:       case Calendar.SEPTEMBER: month = "-09-"; break;
   3:       case Calendar.OCTOBER: month = "-10-"; break;
   4:       case Calendar.NOVEMBER: month = "-11-";  break;
   5:       case Calendar.DECEMBER: month = "-12-";  break;

View Full Code Here
   1:             return 8;
   2:         else if (calendarMonth == Calendar.SEPTEMBER)
   3:             return 9;
   4:         ...
   5:         else if (month == 9)
   6:            return Calendar.SEPTEMBER;
   7:         else if (month == 10)
   8:            return Calendar.OCTOBER;
   9:         else if (month == 11)

View Full Code Here
   1: 
   2:     tmpCal.set(theYear, Calendar.SEPTEMBER, 1);
   3:     dayOfWeek = tmpCal.get(Calendar.DAY_OF_WEEK);
   4:     while (dayOfWeek != Calendar.MONDAY) {
   5:       tmpCal.add(Calendar.DATE, 1);

View Full Code Here
   1:     Calendar cal1 = new GregorianCalendar();
   2:     cal1.set(1977, Calendar.SEPTEMBER, 15, 0, 0, 0);
   3:     cal1.set(Calendar.MILLISECOND, 0);
   4:     assertEquals(date1, cal1.getTime());
   5:     Date date2 = value2.getDate();

View Full Code Here

SUNDAY

public static final int SUNDAY
Value of the DAY_OF_WEEK field indicating Sunday.
Field Value:
1
Usages and Demos :

View More Examples of Calendar.SUNDAY
   1:       return "Saturday";
   2:     case Calendar.SUNDAY:
   3:       return "Sunday";
   4:         ...
   5:     default:
   6:       throw new IllegalArgumentException("'getDay()' must be called with one of the appropriate constants in Calendar (e.g., Calendar.SUNDAY).");
   7:     }
   8:   }

View Full Code Here
   1:             if (cal.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY ||
   2:                     cal.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY)
   3:             {
   4:                 outStream.print("=====");
   5:             }

View Full Code Here
   1:         c.add(Calendar.MILLISECOND, -1);
   2:         assertEquals("Unexpected day of week", Calendar.SUNDAY, c
   3:                 .get(Calendar.DAY_OF_WEEK));
   4:         ...
   5:         c.add(Calendar.MILLISECOND, -1);
   6:         assertEquals("Unexpected day of week", Calendar.SUNDAY, c
   7:                 .get(Calendar.DAY_OF_WEEK));
   8:         ...
   9:         assertEquals("Unexpected day of week, date=" + c.getTime(),
  10:                 Calendar.SUNDAY, c.get(Calendar.DAY_OF_WEEK));
  11:         assertNotSame(adjustedMonday, newSunday());

View Full Code Here
   1:         {
   2:             case Calendar.SUNDAY:
   3:                 return("Sunday");
   4:         ...
   5:         {
   6:             case Calendar.SUNDAY:
   7:                 return(0);
   8:             case Calendar.MONDAY:
   9:                 return(1);

View Full Code Here
   1:     public int getLocalizedFirstDayOfWeek() {
   2:         return java.util.Calendar.SUNDAY;
   3:     }
   4: 
   5:     public boolean isLocalizedAMPMafterTime() {

View Full Code Here

THURSDAY

public static final int THURSDAY
Value of the DAY_OF_WEEK field indicating Thursday.
Field Value:
5
Usages and Demos :

View More Examples of Calendar.THURSDAY
   1:       return "Wednesday";
   2:     case Calendar.THURSDAY:
   3:       return "Thursday";
   4:     case Calendar.FRIDAY:
   5:       return "Friday";

View Full Code Here
   1:                 return("Wednesday");
   2:             case Calendar.THURSDAY:
   3:                 return("Thursday");
   4:         ...
   5:                 return(3);
   6:             case Calendar.THURSDAY:
   7:                 return(4);
   8:             case Calendar.FRIDAY:
   9:                 return(5);

View Full Code Here
   1:     if("WE".equals(day)){return Calendar.WEDNESDAY;}
   2:     if("TH".equals(day)){return Calendar.THURSDAY;}
   3:     if("FR".equals(day)){return Calendar.FRIDAY;}
   4:         ...
   5:     if(Calendar.WEDNESDAY==day){return "WE";}
   6:     if(Calendar.THURSDAY==day){return "TH";}
   7:     if(Calendar.FRIDAY==day){return "FR";}
   8:     if(Calendar.SATURDAY==day){return "SA";}
   9:     throw new IllegalArgumentException("  ERROR: "+day+" is not a valid week day number");

View Full Code Here
   1:                            break;
   2:                        case Calendar.THURSDAY:
   3:                            cal.add(Calendar.DAY_OF_MONTH, -3);
   4:                            startDate = cal.getTime();
   5:                            break;

View Full Code Here
   1:                     insets.top+3*fm.getHeight ());
   2:       g.drawString (weekdayNames [Calendar.THURSDAY], insets.left+4*
   3:                     fieldWidth+(fieldWidth-
   4:         ...
   5:                     fm.stringWidth (weekdayNames [Calendar.THURSDAY]))/2,
   6:                     insets.top+3*fm.getHeight ());
   7:         ...
   8: 
   9:          case Calendar.THURSDAY: col = 4; break;

View Full Code Here

TUESDAY

public static final int TUESDAY
Value of the DAY_OF_WEEK field indicating Tuesday.
Field Value:
3
Usages and Demos :

View More Examples of Calendar.TUESDAY
   1:       return "Monday";
   2:     case Calendar.TUESDAY:
   3:       return "Tuesday";
   4:     case Calendar.WEDNESDAY:
   5:       return "Wednesday";

View Full Code Here
   1:                 return("Monday");
   2:             case Calendar.TUESDAY:
   3:                 return("Tuesday");
   4:         ...
   5:                 return(1);
   6:             case Calendar.TUESDAY:
   7:                 return(2);
   8:             case Calendar.WEDNESDAY:
   9:                 return(3);

View Full Code Here
   1:     if("MO".equals(day)){return Calendar.MONDAY;}
   2:     if("TU".equals(day)){return Calendar.TUESDAY;}
   3:     if("WE".equals(day)){return Calendar.WEDNESDAY;}
   4:         ...
   5:     if(Calendar.MONDAY==day){return "MO";}
   6:     if(Calendar.TUESDAY==day){return "TU";}
   7:     if(Calendar.WEDNESDAY==day){return "WE";}
   8:     if(Calendar.THURSDAY==day){return "TH";}
   9:     if(Calendar.FRIDAY==day){return "FR";}

View Full Code Here
   1:                            break;
   2:                        case Calendar.TUESDAY:
   3:                            cal.add(Calendar.DAY_OF_MONTH, -1);
   4:                            startDate = cal.getTime();
   5:                            break;

View Full Code Here
   1:                     insets.top+3*fm.getHeight ());
   2:       g.drawString (weekdayNames [Calendar.TUESDAY], insets.left+2*fieldWidth+
   3:                     (fieldWidth-
   4:         ...
   5:                     fm.stringWidth (weekdayNames [Calendar.TUESDAY]))/2,
   6:                     insets.top+3*fm.getHeight ());
   7:         ...
   8: 
   9:          case Calendar.TUESDAY: col = 2; break;

View Full Code Here

UNDECIMBER

public static final int UNDECIMBER
Value of the MONTH field indicating the thirteenth month of the year. Although GregorianCalendar does not use this value, lunar calendars do.
Field Value:
12

WEDNESDAY

public static final int WEDNESDAY
Value of the DAY_OF_WEEK field indicating Wednesday.
Field Value:
4
Usages and Demos :

View More Examples of Calendar.WEDNESDAY
   1:       return "Tuesday";
   2:     case Calendar.WEDNESDAY:
   3:       return "Wednesday";
   4:     case Calendar.THURSDAY:
   5:       return "Thursday";

View Full Code Here
   1:                 return("Tuesday");
   2:             case Calendar.WEDNESDAY:
   3:                 return("Wednesday");
   4:         ...
   5:                 return(2);
   6:             case Calendar.WEDNESDAY:
   7:                 return(3);
   8:             case Calendar.THURSDAY:
   9:                 return(4);

View Full Code Here
   1:     if("TU".equals(day)){return Calendar.TUESDAY;}
   2:     if("WE".equals(day)){return Calendar.WEDNESDAY;}
   3:     if("TH".equals(day)){return Calendar.THURSDAY;}
   4:         ...
   5:     if(Calendar.TUESDAY==day){return "TU";}
   6:     if(Calendar.WEDNESDAY==day){return "WE";}
   7:     if(Calendar.THURSDAY==day){return "TH";}
   8:     if(Calendar.FRIDAY==day){return "FR";}
   9:     if(Calendar.SATURDAY==day){return "SA";}

View Full Code Here
   1:                            break;
   2:                        case Calendar.WEDNESDAY:
   3:                            cal.add(Calendar.DAY_OF_MONTH, -2);
   4:                            startDate = cal.getTime();
   5:                            break;

View Full Code Here
   1:                     insets.top+3*fm.getHeight ());
   2:       g.drawString (weekdayNames [Calendar.WEDNESDAY], insets.left+3*
   3:                     fieldWidth+(fieldWidth-
   4:         ...
   5:                     fm.stringWidth (weekdayNames [Calendar.WEDNESDAY]))/2,
   6:                     insets.top+3*fm.getHeight ());
   7:         ...
   8: 
   9:          case Calendar.WEDNESDAY: col = 3; break;

View Full Code Here

WEEK_OF_MONTH

public static final int WEEK_OF_MONTH
Field number for get and set indicating the week number within the current month. The first week of the month, as defined by getFirstDayOfWeek() and getMinimalDaysInFirstWeek(), has value 1. Subclasses define the value of WEEK_OF_MONTH for days before the first week of the month.
Field Value:
4
Usages and Demos :

View More Examples of Calendar.WEEK_OF_MONTH
   1:     System.out.println("Week of month = " +
   2:       gc.get(Calendar.WEEK_OF_MONTH));
   3:     System.out.println("Day of year = " + 
   4:       gc.get(Calendar.DAY_OF_YEAR));
   5:     System.out.println("Day of week = " +

View Full Code Here
   1:     public int getWeekOfMonth() {
   2:     return calendar.get(Calendar.WEEK_OF_MONTH);
   3:     }
   4: 
   5:     public int getDayOfWeek() {

View Full Code Here
   1:     public int getWeekOfMonth() {
   2:     return calendar.get(Calendar.WEEK_OF_MONTH);
   3:     }
   4: 
   5:     public int getDayOfWeek() {

View Full Code Here
   1:     public int getWeekOfMonth() {
   2:     return calendar.get(Calendar.WEEK_OF_MONTH);
   3:     }
   4: 
   5:     public int getDayOfWeek() {

View Full Code Here
   1:     public int getWeekOfMonth() {
   2:     return calendar.get(Calendar.WEEK_OF_MONTH);
   3:     }
   4: 
   5:     public int getDayOfWeek() {

View Full Code Here

WEEK_OF_YEAR

public static final int WEEK_OF_YEAR
Field number for get and set indicating the week number within the current year. The first week of the year, as defined by getFirstDayOfWeek() and getMinimalDaysInFirstWeek(), has value 1. Subclasses define the value of WEEK_OF_YEAR for days before the first week of the year.
Field Value:
3
Usages and Demos :

View More Examples of Calendar.WEEK_OF_YEAR
   1:         now.getTime(), earliest.getTime(), latest.getTime(), 
   2:         Calendar.WEEK_OF_YEAR);
   3:     final JSpinner spinner = new JSpinner(model);
   4:     
   5:     model.addChangeListener( new ChangeListener() {

View Full Code Here
   1:     protected int getCalendarField() {
   2:         return Calendar.WEEK_OF_YEAR;
   3:     }
   4: 
   5:     protected String[] getSqlFunction(SqlGenerationContext context) {

View Full Code Here
   1:         Calendar.MONTH,
   2:         Calendar.WEEK_OF_YEAR,
   3:         Calendar.DAY_OF_YEAR,
   4:         Calendar.HOUR_OF_DAY,
   5:         Calendar.MINUTE,

View Full Code Here
   1:             return new Integer(diffMonth(c0, c1));
   2:         case Calendar.WEEK_OF_YEAR:
   3:             return new Integer(diffWeekOfYear(c0, c1));
   4:         case Calendar.DAY_OF_YEAR:
   5:             return new Integer(diffDay(c0, c1));

View Full Code Here
   1:     if("DAILY".equals(freq)){return Calendar.DAY_OF_MONTH;}
   2:     if("WEEKLY".equals(freq)){return Calendar.WEEK_OF_YEAR;}
   3:     if("MONTHLY".equals(freq)){return Calendar.MONTH;}
   4:     if("YEARLY".equals(freq)){return Calendar.YEAR;}
   5:     throw new IllegalArgumentException("  ERROR: "+freq+" is not a valid FREQ type");

View Full Code Here

YEAR

public static final int YEAR
Field number for get and set indicating the year. This is a calendar-specific value; see subclass documentation.
Field Value:
1
Usages and Demos :

View More Examples of Calendar.YEAR
   1:     protected int getCalendarField() {
   2:         return Calendar.YEAR;
   3:     }
   4: 
   5:     protected String[] getSqlFunction(SqlGenerationContext context) {

View Full Code Here
   1:     static int[] elements = {
   2:         Calendar.YEAR,
   3:         Calendar.MONTH,
   4:         Calendar.WEEK_OF_YEAR,
   5:         Calendar.DAY_OF_YEAR,

View Full Code Here
   1:         set(Calendar.MILLISECOND, 0);
   2:         accuracy = Calendar.YEAR;
   3:     }
   4:         ...
   5:     {
   6:         if (accuracy != Calendar.YEAR && 
   7:             accuracy != Calendar.MONTH && 
   8:         ...
   9:         {
  10:             case Calendar.YEAR:
  11:                 set(Calendar.MONTH, 0);

View Full Code Here
   1:     static int diffYear(Calendar c0, Calendar c1){
   2:         return c1.get(Calendar.YEAR) - c0.get(Calendar.YEAR);
   3:     }
   4:         ...
   5:         int day0, day1;
   6:         year0 = c0.get(Calendar.YEAR);
   7:         day0 = c0.get(Calendar.DAY_OF_YEAR);
   8:         ...
   9:         year1 = c1.get(Calendar.YEAR);
  10:         day1 = c1.get(Calendar.DAY_OF_YEAR);

View Full Code Here
   1:     public static final int DATE = java.util.Calendar.DATE;
   2:     public static final int YEAR = java.util.Calendar.YEAR;
   3: 
   4:         ...
   5:         int d = c.get(java.util.Calendar.DATE);
   6:         int y = c.get(java.util.Calendar.YEAR);
   7:         return new Calendar(y,m,d);
   8:         ...
   9:                 break;
  10:             case java.util.Calendar.YEAR :
  11:                 this.year = value;

View Full Code Here

ZONE_OFFSET

public static final int ZONE_OFFSET
Field number for get and set indicating the raw offset from GMT in milliseconds.

This field reflects the correct GMT offset value of the time zone of this Calendar if the TimeZone implementation subclass supports historical GMT offset changes.

Field Value:
15
Usages and Demos :

View More Examples of Calendar.ZONE_OFFSET
   1:         calendar.set(Calendar.SECOND, 2);
   2:         calendar.set(Calendar.ZONE_OFFSET, 0);
   3:         calendar.set(Calendar.MILLISECOND, 0);
   4:         String source = "January 30, 2005 11:51:02 AM EST";
   5:         List list = new ArrayList();

View Full Code Here
   1:         calendar.set(Calendar.MILLISECOND, 0);
   2:         calendar.set(Calendar.ZONE_OFFSET, -5);
   3:         String converted = "January 30, 2005 11:51:02 AM EST";
   4:         list.add(new ConvertedSourcePair(converted, calendar));
   5:         list.add(new ConvertedSourcePair(converted, calendar.getTime()));

View Full Code Here
   1:     public int getZoneOffset() {
   2:     return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
   3:     }
   4: 

View Full Code Here
   1:     public int getZoneOffset() {
   2:     return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
   3:     }
   4: 

View Full Code Here
   1:     public int getZoneOffset() {
   2:     return calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000);
   3:     }
   4: 

View Full Code Here

areFieldsSet

protected boolean areFieldsSet
True if fields[] are in sync with the currently set time. If false, then the next attempt to get the value of a field will force a recomputation of all fields from the current value of time.

fields

protected int[] fields
The calendar field values for the currently set time for this calendar. This is an array of FIELD_COUNT integers, with index values ERA through DST_OFFSET.

isSet

protected boolean[] isSet
The flags which tell if a specified calendar field for the calendar is set. A new object has no fields set. After the first call to a method which generates the fields, they all remain set after that. This is an array of FIELD_COUNT booleans, with index values ERA through DST_OFFSET.

isTimeSet

protected boolean isTimeSet
True if then the value of time is valid. The time is made invalid by a change to an item of field[].
See Also:
time

time

protected long time
The currently set time for this calendar, expressed in milliseconds after January 1, 1970, 0:00:00 GMT.
See Also:
isTimeSet

Constructor Details

Calendar

protected Calendar()
Constructs a Calendar with the default time zone and locale.

Calendar

protected Calendar(TimeZone zone,
                   Locale aLocale)
Constructs a calendar with the specified time zone and locale.
Parameters:
zone - the time zone to use
aLocale - the locale for the week data

Method Details

add

public abstract void add(int field,
                         int amount)
Adds or subtracts the specified amount of time to the given calendar field, based on the calendar's rules. For example, to subtract 5 days from the current time of the calendar, you can achieve it by calling:

add(Calendar.DAY_OF_MONTH, -5).

Parameters:
field - the calendar field.
amount - the amount of date or time to be added to the field.
Usages and Demos :

View More Examples of add(int field,int amount)
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         int n = ((Number)args[1]).intValue();
   6:         Calendar c = date.getCalendar(context);
   7:         synchronized (c){
   8:         ...
   9:             c.setTime(d);
  10:             c.add(element, n);
  11:             return c.getTime();

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:     }
   6:     public static final void doSafeAddition(Calendar cal, int field, int amount)
   7:     {
   8:         ...
   9: 
  10:             gc.add(field, amount);
  11: 
  12:         ...
  13:         else
  14:             cal.add(field, amount);

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: import java.util.Hashtable;
   4:         ...
   5:    {
   6:       int dateField = Calendar.DATE;
   7:       int amount = 1;
   8:         ...
   9:          case 'n':
  10:             dateField = Calendar.MINUTE;
  11:             break;
  12:         ...
  13:       cal.setTime(executeDate);
  14:       cal.add(dateField, amount);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public static Date parse(int year, int month, int day, int hour, int minute, int second) {
   6:         Calendar calendar = Calendar.getInstance();
   7:         calendar.set(Calendar.YEAR, year);
   8:         ...
   9:         calendar.setTime(date);
  10:         calendar.add(field, amount);
  11:         return calendar.getTime();

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.List;
   4:         ...
   5: 
   6:         Calendar cal = (Calendar) portletSession.getAttribute( "fr.lutece.portlet.cal" );
   7: 
   8:         ...
   9:         {
  10:             cal.add( field, -value );
  11:         }
  12:         ...
  13:         {
  14:             cal.add( field, +value );

View Full Code Here

after

public boolean after(Object when)
Returns whether this Calendar represents a time after the time represented by the specified Object. This method is equivalent to:
compareTo(when) > 0
if and only if when is a Calendar instance. Otherwise, the method returns false.
Parameters:
when - the Object to be compared
Returns:
true if the time of this Calendar is after the time represented by when; false otherwise.
Usages and Demos :

View More Examples of after(Object when)
   1: import java.text.ParseException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         }
   6:         else if ( value instanceof Calendar ) {
   7:         ...
   8:             Calendar cal = (Calendar) value;
   9:         ...
  10:             return cal.after( Calendar.getInstance() );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Comparator;
   4:         ...
   5:         } else if (left instanceof Date) {
   6:             Calendar calendar = Calendar.getInstance();
   7:             calendar.setTime((Date) left);
   8:         ...
   9:             return calendar.after((Date) right);
  10:         } else {

View Full Code Here
   1:     if (!dueDateString.equals("--")) {
   2:       Calendar rightNow = Calendar.getInstance();
   3:         ...
   4:       rightNow.set(Calendar.HOUR_OF_DAY, 0);
   5:       rightNow.set(Calendar.MINUTE, 0);
   6:         ...
   7:           DateFormat.SHORT, locale);
   8:       if (!this.getComplete() && rightNow.after(assignDueDateTest)) {
   9:         return "<font color='red'>" + formatter.format(dueDate) + "</font>";
  10:         ...
  11:         assignDueDateTest.add(Calendar.DATE, -1);
  12:         if (!this.getComplete() && rightNow.after(assignDueDateTest)) {

View Full Code Here

before

public boolean before(Object when)
Returns whether this Calendar represents a time before the time represented by the specified Object. This method is equivalent to:
compareTo(when) <320
if and only if when is a Calendar instance. Otherwise, the method returns false.
Parameters:
when - the Object to be compared
Returns:
true if the time of this Calendar is before the time represented by when; false otherwise.
Usages and Demos :

View More Examples of before(Object when)
   1: import java.text.ParseException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         }
   6:         else if ( value instanceof Calendar ) {
   7:         ...
   8:             Calendar cal = (Calendar) value;
   9:         ...
  10:             return cal.before( Calendar.getInstance() );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Comparator;
   4:         ...
   5:         } else if (left instanceof Date) {
   6:             Calendar calendar = Calendar.getInstance();
   7:             calendar.setTime((Date) left);
   8:         ...
   9:             return calendar.before((Date) right);
  10:         } else {

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:    private EndpointReferenceType _epr;
   6:    private Calendar _expires;
   7:    private FilterType _filter;
   8:         ...
   9:    public EnumerationInfo(String context, EndpointReferenceType epr,
  10:             Calendar expires, FilterType filter) {
  11:       _context = context;
  12:         ...
  13:       Calendar now = new GregorianCalendar();
  14:       return _expires.before(now);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     private Calendar nextRollDate;
   7: 
   8:         ...
   9: 
  10:         nextRollDate = Calendar.getInstance();
  11:         if (token.endsWith("s")) {
  12:         ...
  13:         Calendar now = Calendar.getInstance();
  14:         while (nextRollDate.before(now)) {

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar earliest = Calendar.getInstance();
   7:         earliest.setTime(earliestD);
   8:         ...
   9: 
  10:         while (earliest.before(latest) && soFar < total) {
  11:             Date start, end;

View Full Code Here

clear

public final void clear()
Sets all the calendar field values and the time value (millisecond offset from the Epoch) of this Calendar undefined. This means that isSet() will return false for all the calendar fields, and the date and time calculations will treat the fields as if they had never been set. A Calendar implementation class may use its specific default field values for date/time calculations. For example, GregorianCalendar uses 1970 if the YEAR field value is undefined.
See Also:
clear(int)
Usages and Demos :

View More Examples of clear()
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     {
   6:         Calendar cal = Calendar.getInstance();
   7:         ...
   8:         cal.clear();
   9:         cal.set(Calendar.YEAR, 1997);

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:     public static Date newDate(int month, int date, int year){
   6:         Calendar inst = Calendar.getInstance();
   7:         ...
   8:         inst.clear();
   9:         inst.set(year, month, date);
  10:         ...
  11:         Calendar inst = Calendar.getInstance();
  12:         inst.clear();

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:     public static Date newDate(int month, int date, int year){
   6:         Calendar inst = Calendar.getInstance();
   7:         ...
   8:         inst.clear();
   9:         inst.set(year, month, date);
  10:         ...
  11:         Calendar inst = Calendar.getInstance();
  12:         inst.clear();

View Full Code Here
   1: import java.io.InputStream;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     private Calendar startCalendar;
   7: 
   8:         ...
   9:     private Calendar endCalendar;
  10: 
  11:         ...
  12:         startCalendar = Calendar.getInstance();
  13:         startCalendar.clear();

View Full Code Here
   1: import java.rmi.RemoteException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:       Calendar cal = Calendar.getInstance();
   7:         ...
   8:       cal.clear();
   9:       cal.set(2005, 11, 1, 0, 0);

View Full Code Here

clear

public final void clear(int field)
Sets the given calendar field value and the time value (millisecond offset from the Epoch) of this Calendar undefined. This means that isSet(field) will return false, and the date and time calculations will treat the field as if it had never been set. A Calendar implementation class may use the field's specific default value for date and time calculations.

The HOUR_OF_DAY, HOUR and AM_PM fields are handled independently and the the resolution rule for the time of day is applied. Clearing one of the fields doesn't reset the hour of day value of this Calendar. Use set(Calendar.HOUR_OF_DAY, 0) to reset the hour value.

Parameters:
field - the calendar field to be cleared.
See Also:
clear()
Usages and Demos :

View More Examples of clear(int field)
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: import org.apache.log4j.Category;
   4:         ...
   5:         {
   6:             Calendar cal = Calendar.getInstance();
   7: 
   8:         ...
   9:             cal.clear(Calendar.HOUR);
  10:         ...
  11:             cal.clear(Calendar.MINUTE);

View Full Code Here
   1:       {
   2:       Calendar cal = new GregorianCalendar();
   3:       cal.setTime(day);
   4:         ...
   5:       cal.clear(Calendar.HOUR);
   6:         ...
   7:       cal.clear(Calendar.MINUTE);
   8:         ...
   9:       cal.clear(Calendar.SECOND);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:         if (now > nextRefresh) {
   6:             Calendar c = Calendar.getInstance();
   7:             c.add(Calendar.DAY_OF_MONTH, 1);
   8:         ...
   9:         c.set(Calendar.HOUR_OF_DAY, 6);
  10:         c.clear(Calendar.MINUTE);
  11:         ...
  12:         c.clear(Calendar.SECOND);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:                 case KeyEvent.VK_LEFT:
   6:                     dayDelta(-1, Calendar.DAY_OF_MONTH);
   7:                     break;
   8:         ...
   9:                 case KeyEvent.VK_RIGHT:
  10:                     dayDelta(1, Calendar.DAY_OF_MONTH);
  11:                     break;
  12:         ...
  13:         cal.setTimeInMillis(cal.getTimeInMillis());
  14:         cal.clear(Calendar.DAY_OF_MONTH);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     private Calendar nextRollDate;
   7: 
   8:         ...
   9: 
  10:         nextRollDate = Calendar.getInstance();
  11:         if (token.endsWith("s")) {
  12:         ...
  13:             units = Calendar.SECOND;
  14:             nextRollDate.clear(Calendar.SECOND);

View Full Code Here

clone

public Object clone()
Creates and returns a copy of this object.
Overrides:
clone in interface Object
Returns:
a copy of this object.
Usages and Demos :

View More Examples of clone()
   1: 
   2:     Calendar now = Calendar.getInstance();
   3:         ...
   4:     Calendar earliest = (Calendar)now.clone(); 
   5:     earliest.add( Calendar.MONTH, -6 );
   6:         ...
   7:     Calendar latest = (Calendar)now.clone(); 
   8:     latest.add( Calendar.MONTH, 6 );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:     
   6:     public static String getWeekDescription(Calendar day) {
   7:         ...
   8:         Calendar endDay = nextDay(day,6);
   9:         return getDateDescription(day)+" - "+getDateDescription(endDay);
  10:         ...
  11:     public static Calendar nextDay(final Calendar day) {
  12:         Calendar newcal = (Calendar)day.clone();

View Full Code Here
   1: package org.apache.cocoon.processor.xsp.library.calendar;
   2: 
   3:         ...
   4: import java.util.Date;
   5: import java.util.Calendar;
   6: import java.text.SimpleDateFormat;
   7:         ...
   8:         }
   9:         Calendar calendar = Calendar.getInstance();
  10:         calendar.setTime(date);
  11:         ...
  12:         calendar.set(Calendar.DAY_OF_MONTH,1);
  13:         Calendar temp = (Calendar)calendar.clone();

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:   
   6:   private final Calendar  date;
   7: 
   8:         ...
   9:   public DateValue(Calendar date) {
  10:     super(TYPE, new TransientValueData(date));
  11:         ...
  12:     this.date = (Calendar) date.clone();

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:     boolean intervalSet=false;    
   6:     Calendar cal=Calendar.getInstance( 
   7:         TimeZone.getTimeZone( GREENWICH_MEAN_TIME ));
   8:         ...
   9:     cal.setTime(inDate);
  10:     realCal = (Calendar)cal.clone();
  11:     UTCoffset= ( cal.get(Calendar.ZONE_OFFSET) / UTC_MULTIPLIER );
  12:         ...
  13:     UTCoffset= ( cal.get(Calendar.ZONE_OFFSET) / UTC_MULTIPLIER );
  14:     realCal = (Calendar)cal.clone();

View Full Code Here

compareTo

public int compareTo(Calendar anotherCalendar)
Compares the time values (millisecond offsets from the Epoch) represented by two Calendar objects.
Parameters:
anotherCalendar - the Calendar to be compared.
Returns:
the value 0 if the time represented by the argument is equal to the time represented by this Calendar; a value less than 0 if the time of this Calendar is before the time represented by the argument; and a value greater than 0 if the time of this Calendar is after the time represented by the argument.
Throws:
NullPointerException - if the specified Calendar is null.
IllegalArgumentException - if the time value of the specified Calendar object can't be obtained due to any invalid calendar values.
Since:
1.5

complete

protected void complete()
Fills in any unset fields in the calendar fields. First, the computeTime() method is called if the time value (millisecond offset from the Epoch) has not been calculated from calendar field values. Then, the computeFields() method is called to calculate all calendar field values.

computeFields

protected abstract void computeFields()
Converts the current millisecond time value time to calendar field values in fields[]. This allows you to sync up the calendar field values with a new time that is set for the calendar. The time is not recomputed first; to recompute the time, then the fields, call the complete() method.
See Also:
computeTime()

computeTime

protected abstract void computeTime()
Converts the current calendar field values in fields[] to the millisecond time value time.

equals

public boolean equals(Object obj)
Compares this Calendar to the specified Object. The result is true if and only if the argument is a Calendar object of the same calendar system that represents the same time value (millisecond offset from the Epoch) under the same Calendar parameters as this object.

The Calendar parameters are the values represented by the isLenient, getFirstDayOfWeek, getMinimalDaysInFirstWeek and getTimeZone methods. If there is any difference in those parameters between the two Calendars, this method returns false.

Use the compareTo method to compare only the time values.

Overrides:
equals in interface Object
Parameters:
obj - the object to compare with.
Returns:
true if this object is equal to obj; false otherwise.
Usages and Demos :

View More Examples of equals(Object obj)
   1: {
   2:    private Calendar _cal;
   3:    
   4:         ...
   5:    {
   6:       _cal = Calendar.getInstance();
   7:    }
   8:         ...
   9:       this();
  10:       _cal.set(Calendar.HOUR_OF_DAY, hourofday);
  11:       _cal.set(Calendar.MINUTE, minutes);
  12:         ...
  13:       {
  14:          if (format.equals(PARSE_FORMAT))

View Full Code Here
   1: import javax.jcr.ValueFormatException;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     private final Calendar date;
   7: 
   8:         ...
   9:     public DateValue(Calendar date) {
  10:         super(TYPE);
  11:         ...
  12:             } else if (date != null && other.date != null) {
  13:                 return date.equals(other.date);

View Full Code Here
   1: import java.util.TimeZone;
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5: public class Time {
   6:     private Calendar _value;
   7: 
   8:         ...
   9: 
  10:     public Time(Calendar value) {
  11:         this._value = value;
  12:         ...
  13:              (_value !=null &&
  14:               _value.equals(other._value)));

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5: 
   6:     protected static final Calendar TIME_STAMP_EDEFAULT = null;
   7: 
   8:         ...
   9:     protected Calendar timeStamp = TIME_STAMP_EDEFAULT;
  10: 
  11:         ...
  12:             case WFSPackage.FEATURE_COLLECTION_TYPE__LOCK_ID:
  13:                 return LOCK_ID_EDEFAULT == null ? lockId != null : !LOCK_ID_EDEFAULT.equals(lockId);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:   
   6:   private final Calendar  date;
   7: 
   8:         ...
   9:   public DateValue(Calendar date) {
  10:     super(TYPE, new TransientValueData(date));
  11:         ...
  12:       } else if (date != null && other.date != null) {
  13:         return date.equals(other.date);

View Full Code Here

get

public int get(int field)
Returns the value of the given calendar field. In lenient mode, all calendar fields are normalized. In non-lenient mode, all calendar fields are validated and this method throws an exception if any calendar fields have out-of-range values. The normalization and validation are handled by the complete() method, which process is calendar system dependent.
Parameters:
field - the given calendar field.
Returns:
the value for the given calendar field.
Throws:
ArrayIndexOutOfBoundsException - if the specified field is out of range (field < 0 || field >= FIELD_COUNT).
Usages and Demos :

View More Examples of get(int field)
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     public static void toDayStart(final Calendar cal) {
   7:         ...
   8:         cal.add(Calendar.HOUR, -1 * cal.get(Calendar.HOUR_OF_DAY));
   9:         ...
  10:         cal.add(Calendar.MINUTE, -1 * cal.get(Calendar.MINUTE));

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         Date adjusted = framer.adjustLeft(newMonday());
   6:         Calendar c = (Calendar) Calendar.getInstance().clone();
   7:         c.setTime(adjusted);
   8:         ...
   9:         assertEquals("Unexpected day of week", Calendar.SUNDAY, c
  10:                 .get(Calendar.DAY_OF_WEEK));
  11:         Date adjustedSunday = framer.adjustLeft(newSunday());
  12:         ...
  13:         assertEquals("Unexpected day of week", Calendar.MONDAY, c
  14:                 .get(Calendar.DAY_OF_WEEK));

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar c = Calendar.getInstance();
   7:         c.setFirstDayOfWeek(Calendar.SUNDAY);
   8:         ...
   9:         c.setTime(prevRelease);
  10:         if (c.get(Calendar.DAY_OF_WEEK) == releaseDay) {
  11:             c.add(Calendar.DAY_OF_YEAR, getDayInterval());
  12:         ...
  13:             c.add(Calendar.DAY_OF_YEAR, 1);
  14:             int remainingDays = releaseDay - c.get(Calendar.DAY_OF_WEEK);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar now = null;
   7: 
   8:         ...
   9:         now = Calendar.getInstance();
  10:         now.set(Calendar.MILLISECOND, 0);
  11:         ...
  12:         now = Calendar.getInstance();
  13:         if (now.get(Calendar.DAY_OF_WEEK) == 1) {

View Full Code Here
   1:                 new Date("2002 January 1"),
   2:                 CalendarUtils.round(date1, Calendar.YEAR));
   3:         assertEquals("round year-2 failed",
   4:         ...
   5:                 new Date("2002 January 1"),
   6:                 CalendarUtils.round(date2, Calendar.YEAR));
   7:         assertEquals("round month-1 failed",
   8:         ...
   9:                 new Date("2002 February 1"),
  10:                 CalendarUtils.round(date1, Calendar.MONTH));
  11:         assertEquals("round month-2 failed",
  12:         ...
  13:         now = Calendar.getInstance();
  14:         if (now.get(Calendar.DATE) == 1) {

View Full Code Here

getActualMaximum

public int getActualMaximum(int field)
Returns the maximum value that the specified calendar field could have, given the time value of this Calendar. For example, the actual maximum value of the MONTH field is 12 in some years, and 13 in other years in the Hebrew calendar system.

The default implementation of this method uses an iterative algorithm to determine the actual maximum value for the calendar field. Subclasses should, if possible, override this with a more efficient implementation.

Parameters:
field - the calendar field
Returns:
the maximum of the given calendar field for the time value of this Calendar
Since:
1.2
Usages and Demos :

View More Examples of getActualMaximum(int field)
   1:     text.setText("YYYY/MM/DD");;    
   2:     final Calendar calendar = Calendar.getInstance();
   3:     text.addListener(SWT.Verify, new Listener() {
   4:         ...
   5:             date.replace(e.start, e.start + length, newText);
   6:             calendar.set(Calendar.YEAR, 1901);
   7:             calendar.set(Calendar.MONTH, Calendar.JANUARY);
   8:         ...
   9:                 int month =  Integer.parseInt(mm) - 1;
  10:                 int maxMonth = calendar.getActualMaximum(Calendar.MONTH);
  11:                 if (0 > month || month > maxMonth) return;
  12:         ...
  13:                 int day = Integer.parseInt(dd);
  14:                 int maxDay = calendar.getActualMaximum(Calendar.DATE);

View Full Code Here
   1: import java.util.Iterator;
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:    {
   6:       Calendar cal = Calendar.getInstance();
   7:       Collection entries = checkBook.getCheckBookEntries();
   8:         ...
   9:          cal.set(2003, month, 1);
  10:          int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
  11:          for(int day = 2; day < lastDay; day ++)

View Full Code Here
   1:             {
   2:                 year = ((Calendar)months.iterator().next()).get( Calendar.YEAR );
   3: 
   4:         ...
   5:             {
   6:                 Calendar cal = (Calendar) i.next();
   7: 
   8:         ...
   9:             int firstDay = cal.getActualMinimum( Calendar.DATE );
  10:             int lastDay  = cal.getActualMaximum( Calendar.DATE );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     Calendar cal = rootBlog.getCalendar();
   7:     cal.setTime(monthlyBlog.getDate());
   8:         ...
   9:     int maxDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
  10:     dailyBlog = monthlyBlog.getBlogForDay(maxDay - 1);
  11:         ...
  12:     Date date = monthlyBlog.getDate();
  13:     Calendar cal = rootBlog.getCalendar();

View Full Code Here
   1: import java.io.IOException;
   2: import java.util.Calendar;
   3: import java.util.Map;
   4:         ...
   5:     UIDateInput uiInput = (UIDateInput) component;
   6:     Calendar cal = uiInput.getCalendar();
   7:     Map paramMap = context.getExternalContext().getRequestParameterMap();
   8:         ...
   9:       String value = (String) paramMap.get(uiInput.getName() + DAY_EXTENSION);
  10:       cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(value));
  11:       value = (String) paramMap.get(uiInput.getName() + MONTH_EXTENSION);
  12:         ...
  13:                 cal.get(Calendar.DAY_OF_MONTH), 1, 
  14:                 cal.getActualMaximum(Calendar.DAY_OF_MONTH));

View Full Code Here

getActualMinimum

public int getActualMinimum(int field)
Returns the minimum value that the specified calendar field could have, given the time value of this Calendar.

The default implementation of this method uses an iterative algorithm to determine the actual minimum value for the calendar field. Subclasses should, if possible, override this with a more efficient implementation - in many cases, they can simply return getMinimum().

Parameters:
field - the calendar field
Returns:
the minimum of the given calendar field for the time value of this Calendar
Since:
1.2
Usages and Demos :

View More Examples of getActualMinimum(int field)
   1: import java.sql.Date;
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:         
   6:         Calendar cal = Calendar.getInstance();
   7:         cal.set(year, month, 10);
   8:         ...
   9:         int startDay = cal.getActualMinimum(Calendar.DATE);
  10:         int endDay = cal.getActualMaximum(Calendar.DATE);

View Full Code Here
   1: import java.util.TimeZone;
   2: import java.util.Calendar;
   3: import java.text.DateFormat;
   4:         ...
   5: 
   6:       5, (byte) Calendar.SECOND, 1, (byte) Calendar.SECOND, 10, (byte) Calendar.SECOND, 2,
   7:         ...
   8:       (byte) Calendar.SECOND, 15, (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 20,
   9:       (byte) Calendar.SECOND, 5, (byte) Calendar.SECOND, 30, (byte) Calendar.SECOND, 5,
  10:         ...
  11:     if (true) {
  12:       final int offset = calendar.getActualMinimum(tickField);

View Full Code Here
   1: import java.util.TimeZone;
   2: import java.util.Calendar;
   3: import java.text.DateFormat;
   4:         ...
   5:     private static final byte[] ROLL = {
   6:          5, (byte)Calendar.SECOND,         1, (byte)Calendar.SECOND,
   7:         ...
   8:         10, (byte)Calendar.SECOND,         2, (byte)Calendar.SECOND,
   9:         15, (byte)Calendar.SECOND,         5, (byte)Calendar.SECOND,
  10:         ...
  11:         if (true) {
  12:             final int offset = calendar.getActualMinimum(tickField);

View Full Code Here
   1:     Color fg, bg;
   2:     Calendar calendar;
   3:     DateFormatSymbols formatSymbols;
   4:         ...
   5:     super(parent, checkStyle(style) | SWT.NO_REDRAW_RESIZE);
   6:     calendar = Calendar.getInstance();
   7:     formatSymbols = new DateFormatSymbols();
   8:         ...
   9: boolean isValid(int fieldName, int value) {
  10:     int min = calendar.getActualMinimum(fieldName);
  11:     int max = calendar.getActualMaximum(fieldName);
  12:         ...
  13:             fieldName = fieldNames[currentField];
  14:             setTextField(fieldName, calendar.getActualMinimum(fieldName), true, true);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: import org.jdesktop.swingx.DateSelectionModel;
   6: import org.jdesktop.swingx.calendar.DateUtils;
   7:         ...
   8: import org.jdesktop.swingx.calendar.JXMonthView;
   9: import org.jdesktop.swingx.calendar.JXMonthView.SelectionMode;
  10:         ...
  11:             cal.set(Calendar.DAY_OF_MONTH,
  12:                     cal.getActualMinimum(Calendar.DAY_OF_MONTH));

View Full Code Here

getAvailableLocales

public static Locale[] getAvailableLocales()
Returns an array of all locales for which the getInstance methods of this class can return localized instances. The array returned must contain at least a Locale instance equal to Locale.US.
Returns:
An array of locales for which localized Calendar instances are available.
Usages and Demos :

View More Examples of getAvailableLocales()
   1: 
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5:         locale = Locale.getDefault();
   6:         locales = Calendar.getAvailableLocales();
   7:         length = locales.length;
   8:         localeStrings = new String[length];
   9:     }

View Full Code Here
   1: import java.awt.event.ItemListener;
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5:         addItemListener(this);
   6:         locales = Calendar.getAvailableLocales();
   7:         localeCount = locales.length;
   8: 
   9:         for (int i = 0; i < localeCount; i++) {

View Full Code Here

getFirstDayOfWeek

public int getFirstDayOfWeek()
Gets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
Returns:
the first day of the week.
Usages and Demos :

View More Examples of getFirstDayOfWeek()
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: public class WeekFramerImpl implements DateFrameable {
   6:     private final FramerImpl myDayFramer = new FramerImpl(Calendar.DATE);
   7: 
   8:         ...
   9:     public Date adjustRight(Date baseDate) {
  10:         Calendar c = (Calendar) Calendar.getInstance().clone();
  11:         do {
  12:         ...
  13:             c.setTime(baseDate);
  14:         } while (c.get(Calendar.DAY_OF_WEEK) != c.getFirstDayOfWeek());

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private Calendar calendar;
   7: 
   8:         ...
   9:         calendar.set(Calendar.WEEK_OF_YEAR, week);
  10:         calendar.set(Calendar.DAY_OF_WEEK, calendar.getFirstDayOfWeek());
  11:         return new Day(calendar.getTime());

View Full Code Here
   1:         if (precision != Attribute.NULL) {
   2:             Calendar cal = Calendar.getInstance(getLocale());
   3:             cal.setTime(date);
   4:         ...
   5:                 case PRECISION_YEARS :
   6:                     cal.set(Calendar.MONTH, Calendar.JANUARY);
   7:                 case PRECISION_MONTHS :
   8:         ...
   9:             if (prec == PRECISION_WEEKS) {
  10:                 cal.set(Calendar.DAY_OF_WEEK, cal.getFirstDayOfWeek());
  11:                 cal.set(Calendar.HOUR_OF_DAY, 0);

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:     private int tcols, firstday, showingmonth, showingyear;
   6:     private Calendar calendar, check, navigation;
   7:     private DateFormat formato;
   8:         ...
   9:         
  10:         firstday = calendar.getFirstDayOfWeek();
  11:         setFocusable(true);
  12:         ...
  13:         calendar.add(Calendar.DAY_OF_YEAR, -1 * (calendar.get(Calendar.DAY_OF_MONTH) - 1));
  14:         if (calendar.getFirstDayOfWeek() == Calendar.SUNDAY) {

View Full Code Here
   1: package org.apache.myfaces.custom.calendar;
   2: 
   3:         ...
   4: import java.text.SimpleDateFormat;
   5: import java.util.Calendar;
   6: import java.util.Date;
   7:         ...
   8: 
   9:         Calendar timeKeeper = Calendar.getInstance(currentLocale);
  10:         timeKeeper.setTime(value!=null?value:new Date());
  11:         ...
  12:             writer.writeText(getLocalizedLanguageScript(symbols, months,
  13:                     timeKeeper.getFirstDayOfWeek(),inputCalendar),null);

View Full Code Here

getGreatestMinimum

public abstract int getGreatestMinimum(int field)
Returns the highest minimum value for the given calendar field of this Calendar instance. The highest minimum value is defined as the largest value returned by getActualMinimum(int) for any possible time value. The greatest minimum value depends on calendar system specific parameters of the instance.
Parameters:
field - the calendar field.
Returns:
the highest minimum value for the given calendar field.

getInstance

public static Calendar getInstance()
Gets a calendar using the default time zone and locale. The Calendar returned is based on the current time in the default time zone with the default locale.
Returns:
a Calendar.
Usages and Demos :

View More Examples of getInstance()
   1: import java.text.ParseException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         }
   6:         else if ( value instanceof Calendar ) {
   7:         ...
   8:             Calendar cal = (Calendar) value;
   9:         ...
  10:             return cal.after( Calendar.getInstance() );

View Full Code Here
   1: import java.text.ParseException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         }
   6:         else if ( value instanceof Calendar ) {
   7:         ...
   8:             Calendar cal = (Calendar) value;
   9:         ...
  10:             return cal.before( Calendar.getInstance() );

View Full Code Here
   1: import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:       XmlBeansResourcePropertyUtils.setDateTimePropertyValue( (XmlBeansResourceProperty) prop,
   6:                                                               Calendar.getInstance(  ) );
   7:       return prop;
   8:    }
   9: }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:             PaymentDTOEx payment = new PaymentDTOEx(null, new Float(13.3),
   6:                     Calendar.getInstance().getTime(), 
   7:         ...
   8:                     Calendar.getInstance().getTime(),
   9:                     new Integer(1), new Integer(0), new Integer(1),

View Full Code Here
   1: import org.apache.xmlbeans.XmlObject;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: {
   6:    private Calendar m_terminationTime;
   7:    private Object   m_reason;
   8:         ...
   9:    public AbstractResourceTerminationEvent( Object   resourceId,
  10:                                             Calendar terminationTime,
  11:                                             Object   reason )
  12:         ...
  13:       this( resourceId,
  14:             Calendar.getInstance(  ), reason );

View Full Code Here

getInstance

public static Calendar getInstance(Locale aLocale)
Gets a calendar using the default time zone and specified locale. The Calendar returned is based on the current time in the default time zone with the given locale.
Parameters:
aLocale - the locale for the week data
Returns:
a Calendar.
Usages and Demos :

View More Examples of getInstance(Locale aLocale)
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     public static Calendar getUtcCalendar() {
   7:         ...
   8:         Calendar c = Calendar.getInstance(SystemTime.UTC_TIMEZONE);
   9:         c.setTimeInMillis(currentTimeMillis());

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     private final Date creationDate2 =
   6:         Calendar.getInstance(TimeZone.getTimeZone("GMT"))
   7:                 .getTime();
   8: 
   9:     public FinalMembers(final Date creationDate, final Date modificationDate) {

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:             } else if (typeName.equals("dateTime")) {
   6:             Calendar c =
   7:         ...
   8:                 Calendar.getInstance(TimeZone.getTimeZone("GMT"));
   9:             int i = content.indexOf('-');
  10:         ...
  11:                 }
  12:                 c.set(Calendar.YEAR, year);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5: 
   6:     public static final Calendar getCalendarInstance()
   7:     {
   8:         ...
   9:         return Calendar.getInstance(DEFAULT_LOCALE);
  10:     }
  11:         ...
  12: 
  13:     public static final Calendar getCalendarInstance(String dateString)

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar calendar = getGMTCalendar();
   7:         calendar.set(1601, Calendar.JANUARY, 1, 0, 0, 0);
   8:         ...
   9:     {
  10:         return Calendar.getInstance(TimeZone.getTimeZone("GMT"));
  11:     }

View Full Code Here

getInstance

public static Calendar getInstance(TimeZone zone)
Gets a calendar using the specified time zone and default locale. The Calendar returned is based on the current time in the given time zone with the default locale.
Parameters:
zone - the time zone to use
Returns:
a Calendar.
Usages and Demos :

View More Examples of getInstance(TimeZone zone)
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     public static Calendar getUtcCalendar() {
   7:         ...
   8:         Calendar c = Calendar.getInstance(SystemTime.UTC_TIMEZONE);
   9:         c.setTimeInMillis(currentTimeMillis());

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     private final Date creationDate2 =
   6:         Calendar.getInstance(TimeZone.getTimeZone("GMT"))
   7:                 .getTime();
   8: 
   9:     public FinalMembers(final Date creationDate, final Date modificationDate) {

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:             } else if (typeName.equals("dateTime")) {
   6:             Calendar c =
   7:         ...
   8:                 Calendar.getInstance(TimeZone.getTimeZone("GMT"));
   9:             int i = content.indexOf('-');
  10:         ...
  11:                 }
  12:                 c.set(Calendar.YEAR, year);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5: 
   6:     public static final Calendar getCalendarInstance()
   7:     {
   8:         ...
   9:         return Calendar.getInstance(DEFAULT_LOCALE);
  10:     }
  11:         ...
  12: 
  13:     public static final Calendar getCalendarInstance(String dateString)

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar calendar = getGMTCalendar();
   7:         calendar.set(1601, Calendar.JANUARY, 1, 0, 0, 0);
   8:         ...
   9:     {
  10:         return Calendar.getInstance(TimeZone.getTimeZone("GMT"));
  11:     }

View Full Code Here

getInstance

public static Calendar getInstance(TimeZone zone,
                                   Locale aLocale)
Gets a calendar with the specified time zone and locale. The Calendar returned is based on the current time in the given time zone with the given locale.
Parameters:
zone - the time zone to use
aLocale - the locale for the week data
Returns:
a Calendar.
Usages and Demos :

View More Examples of getInstance(TimeZone zone,Locale aLocale)
   1: import java.io.IOException;
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:         }
   6:         Calendar date = Calendar.getInstance(tz, locale);
   7:         DateFormat uformater = DateFormat.getDateInstance(DateFormat.LONG, locale);
   8:         uformater.setCalendar(date);
   9:         request.setAttribute("date", uformater.format(date.getTime()));

View Full Code Here
   1:         }
   2:         Calendar cal = Calendar.getInstance(tz, locale);
   3:         cal.setTimeInMillis(milisec);
   4:         DateFormat uformatter = DateFormat.getDateTimeInstance(timeFormat, dateFormat, locale);
   5:         uformatter.setCalendar(cal);

View Full Code Here
   1: import java.text.DateFormat;
   2: import java.util.Calendar;
   3: import java.util.Enumeration;
   4:         ...
   5: 
   6: import com.centraview.calendar.CalendarActivityObject;
   7:         ...
   8: import com.centraview.calendar.CvCalendar;
   9: import com.centraview.calendar.CvCalendarHome;
  10:         ...
  11:     if (CVUtility.empty(startDateString)) {
  12:       startDate.setTime(Calendar.getInstance(tz, locale).getTime());

View Full Code Here
   1: import java.text.DateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     Date d = parser.parse(s);
   6:     Calendar c = Calendar.getInstance(UTC, Locale.US);
   7:     c.setTime(d);
   8:     DateMathParser.add(c, v, u);
   9:     return fmt.format(c.getTime());

View Full Code Here
   1: import java.text.DateFormat;
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5: 
   6:         Calendar start = new GregorianCalendar(startYear, startMonth, startDay, 8, 0);
   7:         String startTimeString = tf.format(start);
   8:         ...
   9:         }
  10:         Calendar passedTime = new GregorianCalendar();
  11:         passedTime.setTime(tf.parse(startTimeString));
  12:         ...
  13:         TimeZone userTimeZone = TimeZone.getTimeZone(userTimeZoneId);
  14:         Calendar now = Calendar.getInstance(userTimeZone, locale);

View Full Code Here

getLeastMaximum

public abstract int getLeastMaximum(int field)
Returns the lowest maximum value for the given calendar field of this Calendar instance. The lowest maximum value is defined as the smallest value returned by getActualMaximum(int) for any possible time value. The least maximum value depends on calendar system specific parameters of the instance. For example, a Calendar for the Gregorian calendar system returns 28 for the DAY_OF_MONTH field, because the 28th is the last day of the shortest month of this calendar, February in a common year.
Parameters:
field - the calendar field.
Returns:
the lowest maximum value for the given calendar field.

getMaximum

public abstract int getMaximum(int field)
Returns the maximum value for the given calendar field of this Calendar instance. The maximum value is defined as the largest value returned by the get method for any possible time value. The maximum value depends on calendar system specific parameters of the instance.
Parameters:
field - the calendar field.
Returns:
the maximum value for the given calendar field.
Usages and Demos :

View More Examples of getMaximum(int field)
   1: 
   2:     protected Calendar cal;
   3:     private String Color = "#EEEEEE";
   4:         ...
   5:     public String getHtmlMonth() {
   6:     int saveDay = cal.get(Calendar.DAY_OF_MONTH);
   7:     String top= "<table border=0 width=200 bgcolor=\"" + 
   8:         ...
   9:         "<th colspan=7>" + 
  10:         moy() + " " +cal.get(Calendar.YEAR) +
  11:         "</th></tr>\n<tr><td>S</td><td>M</td>"+
  12:         ...
  13:     String middle = "";
  14:     while (day <= cal.getMaximum(Calendar.DAY_OF_MONTH)) {

View Full Code Here
   1: package com.toedter.calendar;
   2: 
   3:         ...
   4: 
   5: import java.util.Calendar;
   6: 
   7:         ...
   8:     public JYearChooser() {
   9:         Calendar calendar = Calendar.getInstance();
  10:         dayChooser = null;
  11:         ...
  12:         setMinimum(calendar.getMinimum(Calendar.YEAR));
  13:         setMaximum(calendar.getMaximum(Calendar.YEAR));

View Full Code Here
   1: import org.roller.presentation.RollerRequest;
   2: import org.roller.presentation.tags.calendar.CalendarModel;
   3: import org.roller.util.DateUtil;
   4:         ...
   5: import java.text.SimpleDateFormat;
   6: import java.util.Calendar;
   7: import java.util.Date;
   8:         ...
   9:                     
  10:         Calendar cal = Calendar.getInstance();
  11:         
  12:         ...
  13:         
  14:         cal.set(Calendar.DAY_OF_MONTH, cal.getMaximum(Calendar.DAY_OF_MONTH));

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     {
   6:         return getEndOfDay(day,Calendar.getInstance());
   7:     }
   8:         ...
   9:     public static Date getEndOfDay(Date day,Calendar cal)
  10:     {
  11:         ...
  12:         cal.setTime(day);
  13:         cal.set(Calendar.HOUR_OF_DAY, cal.getMaximum(Calendar.HOUR_OF_DAY));

View Full Code Here
   1:     Color fg, bg;
   2:     Calendar calendar;
   3:     DateFormatSymbols formatSymbols;
   4:         ...
   5:     super(parent, checkStyle(style) | SWT.NO_REDRAW_RESIZE);
   6:     calendar = Calendar.getInstance();
   7:     formatSymbols = new DateFormatSymbols();
   8:         ...
   9:     if (fieldName == Calendar.HOUR) {
  10:         int max = calendar.getMaximum(Calendar.HOUR);
  11:         int min = calendar.getMinimum(Calendar.HOUR);

View Full Code Here

getMinimalDaysInFirstWeek

public int getMinimalDaysInFirstWeek()
Gets what the minimal days required in the first week of the year are; e.g., if the first week is defined as one that contains the first day of the first month of a year, this method returns 1. If the minimal days required must be a full week, this method returns 7.
Returns:
the minimal days required in the first week of the year.

getMinimum

public abstract int getMinimum(int field)
Returns the minimum value for the given calendar field of this Calendar instance. The minimum value is defined as the smallest value returned by the get method for any possible time value. The minimum value depends on calendar system specific parameters of the instance.
Parameters:
field - the calendar field.
Returns:
the minimum value for the given calendar field.
Usages and Demos :

View More Examples of getMinimum(int field)
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:     static {
   6:         Calendar cal = Calendar.getInstance();
   7:         
   8:         ...
   9:         TIMES_OF_DAY = new int[cal.getMaximum(Calendar.HOUR_OF_DAY)-cal.getMinimum(Calendar.HOUR_OF_DAY)+1];
  10:         ...
  11:         int time = cal.getMinimum(Calendar.HOUR_OF_DAY);

View Full Code Here
   1: package com.toedter.calendar;
   2: 
   3:         ...
   4: 
   5: import java.util.Calendar;
   6: 
   7:         ...
   8:     public JYearChooser() {
   9:         Calendar calendar = Calendar.getInstance();
  10:         dayChooser = null;
  11:         ...
  12:         setMinimum(calendar.getMinimum(Calendar.YEAR));

View Full Code Here
   1: import org.roller.presentation.RollerRequest;
   2: import org.roller.presentation.tags.calendar.CalendarModel;
   3: import org.roller.util.DateUtil;
   4:         ...
   5: import java.text.SimpleDateFormat;
   6: import java.util.Calendar;
   7: import java.util.Date;
   8:         ...
   9:                     
  10:         Calendar cal = Calendar.getInstance();
  11:         
  12:         ...
  13:         cal.setTime(month);
  14:         cal.set(Calendar.DAY_OF_MONTH, cal.getMinimum(Calendar.DAY_OF_MONTH));

View Full Code Here
   1: import java.lang.reflect.Constructor;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:         if(n >= 0 && n < SchedulerConstants.TIMES_OF_DAY.length) {
   6:             Calendar cal = Calendar.getInstance();
   7:             int targetHour = SchedulerConstants.TIMES_OF_DAY[n];
   8:         ...
   9:                     targetYear++;
  10:                     targetMonth = cal.getMinimum(Calendar.MONTH);
  11:                 }

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:     boolean intervalSet=false;    
   6:     Calendar cal=Calendar.getInstance( 
   7:         TimeZone.getTimeZone( GREENWICH_MEAN_TIME ));
   8:         ...
   9: 
  10:         int month=cal.get(Calendar.MONTH)-cal.getMinimum(Calendar.MONTH)+1;
  11:         int day=cal.get(Calendar.DAY_OF_MONTH);

View Full Code Here

getTime

public final Date getTime()
Returns a Date object representing this Calendar's time value (millisecond offset from the Epoch").
Returns:
a Date representing the time value.
Usages and Demos :

View More Examples of getTime()
   1: 
   2:     Calendar now = Calendar.getInstance();
   3:         ...
   4:     Calendar earliest = (Calendar)now.clone(); 
   5:     earliest.add( Calendar.MONTH, -6 );
   6:         ...
   7:     SpinnerModel model = new SpinnerDateModel( 
   8:         now.getTime(), earliest.getTime(), latest.getTime(), 
   9:         Calendar.WEEK_OF_YEAR);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Timer;
   4:         ...
   5:     
   6:         Calendar c = Calendar.getInstance();
   7:         c.set(Calendar.HOUR_OF_DAY,0);
   8:         c.set(Calendar.MINUTE,1);
   9:         everyDayTimer = new Timer();

View Full Code Here
   1: import java.util.Map;
   2: import java.util.Calendar;
   3: import java.util.Iterator;
   4:         ...
   5:         + ". " + (String) msg.getData("person.name.last");
   6:         Calendar birthday = (Calendar) msg.getData("person.birthday");
   7:         Integer age = (Integer) msg.getData("person.age");
   8:         ...
   9:         log.info(times + ": " + name + " aged " + age + " born on " +
  10:              birthday.getTime());
  11:         msg.putData("addt.seqno", new Integer(times.intValue() + 1));

View Full Code Here
   1: import java.text.ParseException;
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5:     public void testSetEndOfDay() throws ParseException {
   6:         Calendar test = Calendar.getInstance();
   7:         test.setTime(DateHelper.parseDateTime("15-jul-03 12:27"));
   8:         ...
   9:         assertEquals(DateHelper.parseDateTime("15-jul-03 23:59:59:999"), 
  10:                 test.getTime());
  11:     }
  12:         ...
  13:         assertEquals(DateHelper.parseDateTime("31-jul-03 23:59:59:999"), 
  14:                 test.getTime());

View Full Code Here
   1:   static class DataPoint {
   2:     final Calendar time;
   3:     final float temperature;
   4:         ...
   5:     final float humidity;
   6:     public DataPoint(Calendar d, float temp, float hum) {
   7:       time = d;
   8:         ...
   9:     public String toString() {
  10:       return time.getTime() +
  11:         String.format(
  12:         ...
  13:   }
  14:   private Calendar lastTime = Calendar.getInstance();

View Full Code Here

getTimeInMillis

public long getTimeInMillis()
Returns this Calendar's time value in milliseconds.
Returns:
the current time as UTC milliseconds from the epoch.
Usages and Demos :

View More Examples of getTimeInMillis()
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     protected boolean checkCalendar(Calendar calendar) {
   7:         ...
   8:         return calendar.getTimeInMillis() > System.currentTimeMillis();
   9:     }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: 
   4:         ...
   5: 
   6:     protected boolean checkCalendar(Calendar calendar) {
   7:         ...
   8:         return calendar.getTimeInMillis() < System.currentTimeMillis();
   9:     }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.logging.Logger;
   4:         ...
   5:   
   6:   private final Calendar _calendar;
   7:   
   8:         ...
   9:   public JavaCalendarValue(Env env, Calendar calendar, JavaClassDef def)
  10:   {
  11:         ...
  12:   {
  13:     return _calendar.getTimeInMillis();

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private Calendar earlier;
   7: 
   8:         ...
   9:         Assert.notNull(earlier, "IsAfterDateCondition cannot be initialized with a null date");
  10:         this.earlier = Calendar.getInstance();
  11:         this.earlier.setTime(earlier);
  12:         ...
  13:     protected boolean checkCalendar(Calendar calendar) {
  14:         return earlier.getTimeInMillis() < calendar.getTimeInMillis();

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private Calendar later;
   7: 
   8:         ...
   9:         Assert.notNull(later, "IsBeforeDateCondition cannot be initialized with a null date");
  10:         this.later = Calendar.getInstance();
  11:         this.later.setTime(later);
  12:         ...
  13:     protected boolean checkCalendar(Calendar calendar) {
  14:         return later.getTimeInMillis() > calendar.getTimeInMillis();

View Full Code Here

getTimeZone

public TimeZone getTimeZone()
Gets the time zone.
Returns:
the time zone object associated with this calendar.
Usages and Demos :

View More Examples of getTimeZone()
   1: public class date extends obj {
   2:   public Calendar calendar;
   3:   public int timezone;
   4:         ...
   5:      if( !istz ) {
   6:     calendar = new GregorianCalendar( y, mon, d, h, min, s );
   7:         ...
   8:     final TimeZone tmz = calendar.getTimeZone();
   9:     timezone = -tmz.getRawOffset() / 1000;
  10:         ...
  11:       calendar.setTime( d );
  12:       final TimeZone tmz = calendar.getTimeZone();

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:     {
   6:         Calendar c = Calendar.getInstance();
   7:         c.setTimeInMillis(time);
   8:         ...
   9:         TimeZone tz = c.getTimeZone();
  10:         int offset = tz.getOffset(

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public void testDo() throws Exception {
   6:         Calendar cal = Calendar.getInstance();
   7:         ...
   8:         TimeZone tzone = cal.getTimeZone();
   9:         System.out.println(tzone.getID());

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     public IsBeforeInstantCondition(Calendar later) {
   7:         ...
   8:         this.later = new DateTime(later.getTimeInMillis(), DateTimeZone.forTimeZone(later.getTimeZone()));
   9:     }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     public IsAfterInstantCondition(Calendar earlier) {
   7:         ...
   8:         this.earlier = new DateTime(earlier.getTimeInMillis(), DateTimeZone.forTimeZone(earlier.getTimeZone()));
   9:     }

View Full Code Here

hashCode

public int hashCode()
Returns a hash code for this calendar.
Overrides:
hashCode in interface Object
Returns:
a hash code value for this object.
Since:
1.2
Usages and Demos :

View More Examples of hashCode()
   1: import java.math.BigInteger;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:    public BigInteger integer;
   6:    public Calendar dateTime;
   7:    public String string;
   8:         ...
   9:       int result;
  10:       result = (integer != null ? integer.hashCode() : 0);
  11:         ...
  12:       result = 29 * result + (dateTime != null ? dateTime.hashCode() : 0);

View Full Code Here
   1: {
   2:    private Calendar _cal;
   3:    
   4:         ...
   5:    {
   6:       _cal = Calendar.getInstance();
   7:    }
   8:         ...
   9:       this();
  10:       _cal.set(Calendar.HOUR_OF_DAY, hourofday);
  11:       _cal.set(Calendar.MINUTE, minutes);
  12:         ...
  13: 
  14:    public int hashCode() { return _cal.hashCode(); }

View Full Code Here
   1: {
   2:    private Calendar _startCal;
   3:         ...
   4:    private Calendar _endCal;
   5:    private transient TimeInterval _duration;
   6:         ...
   7:    {
   8:       Calendar start = new TimeEO(8, 0).calendarValue();
   9:       Calendar end = new TimeEO(9, 0).calendarValue();
  10:         ...
  11:    {
  12:       return _startCal.hashCode() * 31 + _endCal.hashCode();

View Full Code Here

internalGet

protected final int internalGet(int field)
Returns the value of the given calendar field. This method does not involve normalization or validation of the field value.
Parameters:
field - the given calendar field.
Returns:
the value for the given calendar field.
See Also:
get(int)

isLenient

public boolean isLenient()
Tells whether date/time interpretation is to be lenient.
Returns:
true if the interpretation mode of this calendar is lenient; false otherwise.
Usages and Demos :

View More Examples of isLenient()
   1: import java.io.InvalidObjectException;
   2: import jp.ujihara.java.util.Calendar;
   3: import jp.ujihara.java.util.Date;
   4:         ...
   5: {
   6:   protected Calendar calendar;
   7:   protected NumberFormat numberFormat;
   8:         ...
   9:   {
  10:     return calendar.isLenient();
  11:   }

View Full Code Here

isSet

public final boolean isSet(int field)
Determines if the given calendar field has a value set, including cases that the value has been set by internal fields calculations triggered by a get method call.
Returns:
true if the given calendar field has a value set; false otherwise.

roll

public abstract void roll(int field,
                          boolean up)
Adds or subtracts (up/down) a single unit of time on the given time field without changing larger fields. For example, to roll the current date up by one day, you can achieve it by calling:

roll(Calendar.DATE, true). When rolling on the year or Calendar.YEAR field, it will roll the year value in the range between 1 and the value returned by calling getMaximum(Calendar.YEAR). When rolling on the month or Calendar.MONTH field, other fields like date might conflict and, need to be changed. For instance, rolling the month on the date 01/31/96 will result in 02/29/96. When rolling on the hour-in-day or Calendar.HOUR_OF_DAY field, it will roll the hour value in the range between 0 and 23, which is zero-based.

Parameters:
field - the time field.
up - indicates if the value of the specified time field is to be rolled up or rolled down. Use true if rolling up, false otherwise.
Usages and Demos :

View More Examples of roll(int field,boolean up)
   1: import java.text.DateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public String browse() throws Exception {
   6:         Calendar cal = GregorianCalendar.getInstance();
   7:         now = cal.getTime();
   8:         ...
   9:         cal.roll(Calendar.DATE, -1);
  10:         ...
  11:         cal.roll(Calendar.HOUR, -3);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private static Calendar parseDate(String datetime) {
   7:         ...
   8:         Calendar c = Calendar.getInstance();
   9:         try {
  10:         ...
  11:         if (shifted) {
  12:             c.roll(field, true);

View Full Code Here
   1: package fr.paris.lutece.plugins.calendar.web;
   2: 
   3:         ...
   4: import fr.paris.lutece.plugins.calendar.business.Agenda;
   5:         ...
   6: import fr.paris.lutece.plugins.calendar.service.Utils;
   7: import fr.paris.lutece.portal.service.util.AppPropertiesService;
   8:         ...
   9:                 int nDay = calendar.get( Calendar.DAY_OF_MONTH );
  10:                 calendar.roll( Calendar.DAY_OF_MONTH, true );

View Full Code Here
   1: package fr.paris.lutece.plugins.calendar.web;
   2: 
   3:         ...
   4: import fr.paris.lutece.plugins.calendar.business.Agenda;
   5:         ...
   6: import fr.paris.lutece.plugins.calendar.business.MultiAgenda;
   7: import fr.paris.lutece.plugins.calendar.business.MultiAgendaEvent;
   8:         ...
   9:             sbDays.append( getDay( calendar, agenda, locale ) );
  10:             calendar.roll( Calendar.DAY_OF_WEEK, true );

View Full Code Here
   1: 
   2:     private Calendar c;
   3:     private Date origd;
   4:         ...
   5:     private void updateFields() {
   6:     h.setText((new Integer(c.get(Calendar.HOUR_OF_DAY))).toString());
   7:         ...
   8:     min.setText((new Integer(c.get(Calendar.MINUTE))).toString());
   9:     s.setText((new Integer(c.get(Calendar.SECOND))).toString());
  10:         ...
  11:     c.setTime(currd);
  12:     c.roll(field, plus);

View Full Code Here

roll

public void roll(int field,
                 int amount)
Adds the specified (signed) amount to the specified calendar field without changing larger fields. A negative amount means to roll down.

NOTE: This default implementation on Calendar just repeatedly calls the version of roll() that rolls by one unit. This may not always do the right thing. For example, if the DAY_OF_MONTH field is 31, rolling through February will leave it set to 28. The GregorianCalendar version of this function takes care of this problem. Other subclasses should also provide overrides of this function that do the right thing.

Parameters:
field - the calendar field.
amount - the signed amount to add to the calendar field.
Since:
1.2
Usages and Demos :

View More Examples of roll(int field,int amount)
   1: import java.text.DateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public String browse() throws Exception {
   6:         Calendar cal = GregorianCalendar.getInstance();
   7:         now = cal.getTime();
   8:         ...
   9:         cal.roll(Calendar.DATE, -1);
  10:         ...
  11:         cal.roll(Calendar.HOUR, -3);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private static Calendar parseDate(String datetime) {
   7:         ...
   8:         Calendar c = Calendar.getInstance();
   9:         try {
  10:         ...
  11:         if (shifted) {
  12:             c.roll(field, true);

View Full Code Here
   1: package fr.paris.lutece.plugins.calendar.web;
   2: 
   3:         ...
   4: import fr.paris.lutece.plugins.calendar.business.Agenda;
   5:         ...
   6: import fr.paris.lutece.plugins.calendar.service.Utils;
   7: import fr.paris.lutece.portal.service.util.AppPropertiesService;
   8:         ...
   9:                 int nDay = calendar.get( Calendar.DAY_OF_MONTH );
  10:                 calendar.roll( Calendar.DAY_OF_MONTH, true );

View Full Code Here
   1: package fr.paris.lutece.plugins.calendar.web;
   2: 
   3:         ...
   4: import fr.paris.lutece.plugins.calendar.business.Agenda;
   5:         ...
   6: import fr.paris.lutece.plugins.calendar.business.MultiAgenda;
   7: import fr.paris.lutece.plugins.calendar.business.MultiAgendaEvent;
   8:         ...
   9:             sbDays.append( getDay( calendar, agenda, locale ) );
  10:             calendar.roll( Calendar.DAY_OF_WEEK, true );

View Full Code Here
   1: 
   2:     private Calendar c;
   3:     private Date origd;
   4:         ...
   5:     private void updateFields() {
   6:     h.setText((new Integer(c.get(Calendar.HOUR_OF_DAY))).toString());
   7:         ...
   8:     min.setText((new Integer(c.get(Calendar.MINUTE))).toString());
   9:     s.setText((new Integer(c.get(Calendar.SECOND))).toString());
  10:         ...
  11:     c.setTime(currd);
  12:     c.roll(field, plus);

View Full Code Here

set

public void set(int field,
                int value)
Sets the given calendar field to the given value. The value is not interpreted by this method regardless of the leniency mode.
Parameters:
field - the given calendar field.
value - the value to be set for the given calendar field.
Throws:
ArrayIndexOutOfBoundsException - if the specified field is out of range (field < 0 || field >= FIELD_COUNT). in non-lenient mode.
Usages and Demos :

View More Examples of set(int field,int value)
   1: 
   2: import static java.util.Calendar.*;
   3: 
   4:         ...
   5: import java.text.SimpleDateFormat;
   6: import java.util.Calendar;
   7: import java.util.Date;
   8:         ...
   9: 
  10:     public static void clearTime(final Calendar calendar) {
  11:         ...
  12:         calendar.set(HOUR_OF_DAY, 0);

View Full Code Here
   1: {
   2:    private Calendar _cal;
   3:    
   4:         ...
   5:    {
   6:       _cal = Calendar.getInstance();
   7:    }
   8:         ...
   9:       this();
  10:       _cal.set(Calendar.HOUR_OF_DAY, hourofday);
  11:         ...
  12:       _cal.set(Calendar.MINUTE, minutes);

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.List;
   4:         ...
   5: 
   6:         Calendar cal = (Calendar) portletSession.getAttribute( "fr.lutece.portlet.cal" );
   7: 
   8:         ...
   9:         {
  10:             cal.set( field, value );
  11:         }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:   protected void configureCalendar(final Calendar calendar)
   7:   {
   8:         ...
   9:     Number n = (Number) o;
  10:     calendar.set(field, n.intValue());
  11:   }

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     private static final int[] DATE_ITEMS = new int[]{ Calendar.YEAR,
   7:         ...
   8:         Calendar.MONTH, Calendar.DAY_OF_MONTH, Calendar.HOUR_OF_DAY,
   9:         Calendar.MINUTE, Calendar.SECOND };
  10:         ...
  11:                 }
  12:                 calendar.set(DATE_ITEMS[i], item);

View Full Code Here

set

public final void set(int year,
                      int month,
                      int date)
Sets the values for the calendar fields YEAR, MONTH, and DAY_OF_MONTH. Previous values of other calendar fields are retained. If this is not desired, call clear() first.
Parameters:
year - the value used to set the YEAR calendar field.
month - the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DAY_OF_MONTH calendar field.
Usages and Demos :

View More Examples of set(int year,int month,int date)
   1: import java.io.*;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     private Date vytvorDatum() {
   6:         Calendar c = Calendar.getInstance();
   7:         ...
   8:         c.set(1947, 7, 15);
   9:         return c.getTime();

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import javax.xml.namespace.QName;
   4:         ...
   5:     private static String getValueAsString(Object value) {
   6:         Calendar _value = (Calendar) value;
   7:         ...
   8:                 _value.set(0, 0, 0);
   9:         return ZULU.format(_value.getTime());

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         TypeMappingException {
   6:         Calendar calendar = Calendar.getInstance();
   7:         Date date = null;
   8:         ...
   9:         calendar.setTime(date);
  10:         calendar.set(0, 0, 0);         return calendar;
  11:     }

View Full Code Here
   1: import java.util.Hashtable;
   2: import java.util.Calendar;
   3: import java.util.Iterator;
   4:         ...
   5:         data.put("person.name.last", "Kangasharju");
   6:         Calendar date = Calendar.getInstance();
   7:         ...
   8:         date.set(1975, 5, 19);
   9:         data.put("person.birthday", date);

View Full Code Here
   1: import java.util.TimeZone;
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5: public class Time {
   6:     private Calendar _value;
   7: 
   8:         ...
   9: 
  10:     public Time(Calendar value) {
  11:         this._value = value;

View Full Code Here

set

public final void set(int year,
                      int month,
                      int date,
                      int hourOfDay,
                      int minute)
Sets the values for the calendar fields YEAR, MONTH, DAY_OF_MONTH, HOUR_OF_DAY, and MINUTE. Previous values of other fields are retained. If this is not desired, call clear() first.
Parameters:
year - the value used to set the YEAR calendar field.
month - the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DAY_OF_MONTH calendar field.
hourOfDay - the value used to set the HOUR_OF_DAY calendar field.
minute - the value used to set the MINUTE calendar field.
Usages and Demos :

View More Examples of set(int year,int month,int date,int hourOfDay,int minute)
   1: import java.rmi.RemoteException;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:       Calendar cal = Calendar.getInstance();
   7:       cal.clear();
   8:         ...
   9:       cal.set(2005, 11, 1, 0, 0);

View Full Code Here
   1:     
   2:     protected void moveToIntervalStart(Calendar cal) {
   3:         ...
   4:         int year = cal.get(Calendar.YEAR);
   5:         ...
   6:         int month = cal.get(Calendar.MONTH);
   7:         int day = cal.get(Calendar.DAY_OF_MONTH);
   8:         ...
   9:         cal.clear();
  10:         cal.set(year, month, day, hour, 0);

View Full Code Here
   1: package com.dstc.security.asn1;
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5: 
   6:     Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("AEST"));
   7:     cal.add(Calendar.HOUR_OF_DAY, offset);
   8:         ...
   9:           minute = java.lang.Integer.parseInt (utc.substring (8, 10));
  10:           cal.set(year, month, date, hour, minute);
  11:           break;

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.net.URL;
   4:         ...
   5: 
   6:         Calendar date = Calendar.getInstance();
   7:         ...
   8:         date.set(1975, 5, 19, 23, 46);
   9:         timer.end(token, "Preparations");

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:     public void testDayAndHoursTimeFrameEvenBounds() throws Exception {
   6:         Calendar c = (Calendar) GregorianCalendar.getInstance().clone();
   7:         ...
   8:         c.set(2000, Calendar.JANUARY, 1, 0, 0);
   9:         GregorianTimeUnitStack stack = new GregorianTimeUnitStack();
  10:         ...
  11:         Calendar c = (Calendar) GregorianCalendar.getInstance().clone();
  12:         c.set(2000, Calendar.JANUARY, 1, 12, 0);

View Full Code Here

set

public final void set(int year,
                      int month,
                      int date,
                      int hourOfDay,
                      int minute,
                      int second)
Sets the values for the fields YEAR, MONTH, DAY_OF_MONTH, HOUR, MINUTE, and SECOND. Previous values of other fields are retained. If this is not desired, call clear() first.
Parameters:
year - the value used to set the YEAR calendar field.
month - the value used to set the MONTH calendar field. Month value is 0-based. e.g., 0 for January.
date - the value used to set the DAY_OF_MONTH calendar field.
hourOfDay - the value used to set the HOUR_OF_DAY calendar field.
minute - the value used to set the MINUTE calendar field.
second - the value used to set the SECOND calendar field.
Usages and Demos :

View More Examples of set(int year,int month,int date,int hourOfDay,int minute,int second)
   1:     public static void main(String[] argv) {
   2:         Calendar c = Calendar.getInstance();
   3:         System.out.println("I got a " + c.getClass());
   4:         ...
   5:         c.set(1951, 03, 24, 12, 30, 0);
   6:         System.out.println("I set it to " + c.getTime().toString());
   7:         ...
   8:         System.out.println("I actually set the year to " +c.get(Calendar.YEAR));
   9:         System.out.println("In milliseconds, that's " + c.getTime().getTime());

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar calendar = getGMTCalendar();
   7:         ...
   8:         calendar.set(1601, Calendar.JANUARY, 1, 0, 0, 0);
   9:         calendar.set(Calendar.MILLISECOND, 0);

View Full Code Here
   1: import java.net.InetAddress;
   2: import java.util.Calendar;
   3: import java.io.IOException;
   4:         ...
   5:         TimeZone utcZone = TimeZone.getTimeZone("UTC");
   6:         Calendar calendar = Calendar.getInstance(utcZone);
   7:         ...
   8:         calendar.set(1900, Calendar.JANUARY, 1, 0, 0, 0);
   9:         calendar.set(Calendar.MILLISECOND, 0);

View Full Code Here
   1: import java.lang.reflect.Constructor;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         if ( multiYear ) {
   6:             gc1.add(Calendar.YEAR, -field*(est-2));
   7:             est = -field*est;
   8:         ...
   9:         }
  10:         int f = multiYear ? Calendar.YEAR : field;
  11:         int inc = multiYear ? -field : 1;
  12:         ...
  13:         c.clear(Calendar.MILLISECOND);
  14:         c.set(year, month, day, 0, 0, 0);

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:             SingleCalendar.clear();
   6:             SingleCalendar.set(year + 1900, month, day, 0, 0, 0);
   7: 
   8:         ...
   9:             SingleCalendar.clear();
  10:             SingleCalendar.set(0, 0, 0, hours, minutes, seconds);

View Full Code Here

setFirstDayOfWeek

public void setFirstDayOfWeek(int value)
Sets what the first day of the week is; e.g., SUNDAY in the U.S., MONDAY in France.
Parameters:
value - the given first day of the week.
Usages and Demos :

View More Examples of setFirstDayOfWeek(int value)
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:         Calendar c = Calendar.getInstance();
   7:         ...
   8:         c.setFirstDayOfWeek(Calendar.SUNDAY);
   9:         c.setTime(prevRelease);
  10:         ...
  11:         Calendar c = Calendar.getInstance();
  12:         c.setFirstDayOfWeek(Calendar.SUNDAY);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public void testCalculateNextReleaseDate()  throws Exception {
   6:         Calendar c = Calendar.getInstance();
   7:         ...
   8:         c.setFirstDayOfWeek(Calendar.SUNDAY);
   9:         Date today = c.getTime();
  10:         ...
  11:         c = Calendar.getInstance();
  12:         c.setFirstDayOfWeek(Calendar.SUNDAY);

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Collection;
   4:         ...
   5:     private int tcols, firstday, showingmonth, showingyear;
   6:     private Calendar calendar, check, navigation;
   7:     private DateFormat formato;
   8:         ...
   9:         if ((firstDayOfWeek == Calendar.MONDAY) || (firstDayOfWeek == Calendar.SUNDAY)) {
  10:             calendar.setFirstDayOfWeek(firstDayOfWeek);
  11:         ...
  12:             check.setFirstDayOfWeek(firstDayOfWeek);

View Full Code Here
   1: import java.util.ArrayList;
   2: import java.util.Calendar;
   3: import java.util.Collections;
   4:         ...
   5: 
   6:     private static Calendar calendar = Calendar.getInstance();
   7:     static {
   8:         ...
   9:         calendar.setFirstDayOfWeek(Calendar.SUNDAY);
  10:     }

View Full Code Here

setLenient

public void setLenient(boolean lenient)
Specifies whether or not date/time interpretation is to be lenient. With lenient interpretation, a date such as "February 942, 1996" will be treated as being equivalent to the 941st day after February 1, 1996. With strict (non-lenient) interpretation, such dates will cause an exception to be thrown. The default is lenient.
Parameters:
lenient - true if the lenient mode is to be turned on; false if it is to be turned off.
Usages and Demos :

View More Examples of setLenient(boolean lenient)
   1:     try {
   2:       Calendar cal=new GregorianCalendar();
   3:         ...
   4:       cal.setLenient(false);
   5:       cal.set(Integer.parseInt(_lastRelease.substring(0,4)),
   6:           Integer.parseInt(_lastRelease.substring(4,6))-1,
   7:           Integer.parseInt(_lastRelease.substring(6,8)));

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         {
   6:             Calendar cal = Calendar.getInstance();
   7:         ...
   8:             cal.setLenient(false);
   9:             cal.set(yyyy, mm, dd, hh, min, ss);

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:       int year = Integer.parseInt(val.substring(3));
   6:       Calendar c = Calendar.getInstance();
   7:         ...
   8:       c.setLenient(false);
   9:       mDate = c.getTime();

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:     protected Date getDate(String expression) throws QueryException {
   6:         Calendar calendar = new GregorianCalendar();
   7:         ...
   8:         calendar.setLenient(false);
   9:         calendar.set(Calendar.HOUR_OF_DAY, 0);

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:     protected Date getDate(String expression) throws QueryException {
   6:         Calendar calendar = new GregorianCalendar();
   7:         ...
   8:         calendar.setLenient(false);
   9:         calendar.set(Calendar.MILLISECOND, 0);

View Full Code Here

setMinimalDaysInFirstWeek

public void setMinimalDaysInFirstWeek(int value)
Sets what the minimal days required in the first week of the year are; For example, if the first week is defined as one that contains the first day of the first month of a year, call this method with value 1. If it must be a full week, use value 7.
Parameters:
value - the given minimal days required in the first week of the year.
Usages and Demos :

View More Examples of setMinimalDaysInFirstWeek(int value)
   1: import java.text.MessageFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:         TextFormatter {
   6:     private Calendar myCalendar;
   7: 
   8:         ...
   9:     WeekTextFormatter(String formatString) {
  10:         myCalendar = (Calendar) Calendar.getInstance().clone();
  11:     }
  12:         ...
  13:         myCalendar.setTime(startDate);
  14:         myCalendar.setMinimalDaysInFirstWeek(7);

View Full Code Here
   1: import java.io.ObjectOutputStream;
   2: import java.util.Calendar;
   3: import java.util.Locale;
   4:         ...
   5:         Week w1 = new Week(1, 2005);
   6:         Calendar c1 = Calendar.getInstance(
   7:             TimeZone.getTimeZone("Europe/London"), Locale.UK
   8:         );
   9:         assertEquals(1104710400000L, w1.getFirstMillisecond(c1));

View Full Code Here

setTime

public final void setTime(Date date)
Sets this Calendar's time with the given Date.

Note: Calling setTime() with Date(Long.MAX_VALUE) or Date(Long.MIN_VALUE) may yield incorrect field values from get().

Parameters:
date - the given Date.
Usages and Demos :

View More Examples of setTime(Date date)
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public Object fromString(String str) {
   6:         return ((Calendar)super.fromString(str)).getTime();
   7:     }
   8:         ...
   9:     public String toString(Object obj) {
  10:         Calendar calendar = Calendar.getInstance();
  11:         ...
  12:         calendar.setTime((Date)obj);

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:         }
   6:         Calendar c = Calendar.getInstance(date.getTimeZone(context),
   7:                                           locale.getLocale(context));
   8:         ...
   9:         c.setTime((Date)key);
  10:         return c;

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:         
   6:         Calendar calendar1 = java.util.Calendar.getInstance();
   7:         Calendar calendar2 = java.util.Calendar.getInstance();
   8:         ...
   9:         calendar1.setTime( (java.util.Date) x );
  10:         ...
  11:         calendar2.setTime( (java.util.Date) y );

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:         
   6:         Calendar calendar1 = java.util.Calendar.getInstance();
   7:         Calendar calendar2 = java.util.Calendar.getInstance();
   8:         ...
   9:         calendar1.setTime( (java.util.Date) x );
  10:         ...
  11:         calendar2.setTime( (java.util.Date) y );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Comparator;
   4:         ...
   5:         } else if (left instanceof Date) {
   6:             Calendar calendar = Calendar.getInstance();
   7:         ...
   8:             calendar.setTime((Date) left);
   9:             return calendar.before((Date) right);

View Full Code Here

setTimeInMillis

public void setTimeInMillis(long millis)
Sets this Calendar's current time from the given long value.
Parameters:
millis - the new time in UTC milliseconds from the epoch.
Usages and Demos :

View More Examples of setTimeInMillis(long millis)
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5: 
   6:     public static Calendar getUtcCalendar() {
   7:         ...
   8:         Calendar c = Calendar.getInstance(SystemTime.UTC_TIMEZONE);
   9:         ...
  10:         c.setTimeInMillis(currentTimeMillis());

View Full Code Here
   1: import java.io.InputStream;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:       in.read();
   6:       Calendar lastMod = Calendar.getInstance();
   7:       if (ctx.getModificationTime() != 0) {
   8:         ...
   9:           lastMod.setTimeInMillis(ctx.getModificationTime());
  10:       }

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:         Params query = new Params();
   6:         Calendar minc = new GregorianCalendar(s_utcZone);
   7:         ...
   8:         minc.setTimeInMillis(data.m_timeMin);
   9:         query.setMinDate(minc);
  10:         ...
  11:         Calendar maxc = new GregorianCalendar(s_utcZone);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.GregorianCalendar;
   4:         ...
   5:         _query query = new _query();
   6:         Calendar minc = new GregorianCalendar(s_utcZone);
   7:         ...
   8:         minc.setTimeInMillis(data.m_timeMin);
   9:         query.setMinDate(minc);
  10:         ...
  11:         Calendar maxc = new GregorianCalendar(s_utcZone);

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:   public static synchronized Date getDateObject(String date) throws Exception {
   6:     Calendar calendar = Calendar.getInstance();
   7:         ...
   8:     calendar.setTimeInMillis(0);
   9:     StringTokenizer st = new StringTokenizer(date, "/");

View Full Code Here

setTimeZone

public void setTimeZone(TimeZone value)
Sets the time zone with the given time zone value.
Parameters:
value - the given time zone.
Usages and Demos :

View More Examples of setTimeZone(TimeZone value)
   1:   {
   2:     Calendar cal = new GregorianCalendar();
   3:         ...
   4:     cal.setTimeZone(TimeZone.getTimeZone("ECT"));
   5:     cal.setTime(cal.getTime());
   6:         ...
   7:     
   8:     cal.set( Calendar.DATE, 1 );
   9:         ...
  10:     cal.set( Calendar.MONTH, Calendar.MARCH );

View Full Code Here
   1: 
   2: import java.util.Calendar;
   3: import java.util.TimeZone;
   4:         ...
   5:         } else if (name.equals("dateTime")) {
   6:             Calendar c = (Calendar) o;
   7:             if (c != null) {
   8:         ...
   9:             c.setTimeZone(TimeZone.getTimeZone("GMT"));
  10:             StringBuffer buf = new StringBuffer();

View Full Code Here
   1: import java.util.GregorianCalendar;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:     private static TimeZone UTC = new SimpleTimeZone(0,"UTC");
   6:     private static Calendar c = new GregorianCalendar(1900,Calendar.JANUARY,1,0,0,0);
   7:     private static Date startOfCentury;
   8:         ...
   9:     {
  10:         c.setTimeZone(UTC);
  11:         startOfCentury=c.getTime();

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.Date;
   4:         ...
   5:     public static long pushToEndOfDay(long time) {
   6:     return pushToEndOfDay(Calendar.getInstance(), time);
   7:     }    
   8:         ...
   9: 
  10:     public static long pushToEndOfDay(Calendar calendar, long time) {
  11:     calendar.setTime(new Date(time));
  12:         ...
  13:      calendar.set(Calendar.MILLISECOND, 999);
  14:         calendar.setTimeZone(TimeZone.getTimeZone("GMT"));

View Full Code Here
   1: import java.security.Principal;
   2: import java.util.Calendar;
   3: import java.util.Currency;
   4:         ...
   5:     public void testGregorianCalendar() {
   6:         Calendar in = Calendar.getInstance();
   7:         ...
   8:         in.setTimeZone(TimeZone.getTimeZone("AST"));
   9:         in.setTimeInMillis(44444);

View Full Code Here

toString

public String toString()
Return a string representation of this calendar. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations. The returned string may be empty but may not be null.
Overrides:
toString in interface Object
Returns:
a string representation of this calendar.
Usages and Demos :

View More Examples of toString()
   1: import org.apache.xmlbeans.impl.values.XmlDateTimeImpl;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:    public static void setDateTimePropertyValue( XmlBeansResourceProperty prop,
   6:                                                 Calendar                 time )
   7:    {
   8:         ...
   9:                                  prop.getMetaData(  ).getName(  ),
  10:                                  time.toString(  ) ) );
  11:       XmlDateTimeImpl propElem = (XmlDateTimeImpl) getDateTimePropertyElement( prop );
  12:         ...
  13: 
  14:    public static Calendar getDateTimePropertyValue( XmlBeansResourceProperty prop )

View Full Code Here
   1: 
   2: package edu.washington.cac.calendar.data;
   3: 
   4:         ...
   5: import java.sql.Time;
   6: import java.util.Calendar;
   7: import java.util.Iterator;
   8:         ...
   9: 
  10: import edu.washington.cac.calendar.CalLogFactory;
  11: import edu.washington.cac.calendar.CalParameter;
  12:         ...
  13:     if (!(c instanceof Event)) {
  14:       return toString().compareTo(c.toString()) < 0;

View Full Code Here
   1: import java.util.Date;
   2: import java.util.Calendar;
   3: 
   4:         ...
   5:         
   6:         Calendar gregcal = new GDate("--02-29").getCalendar();
   7:         ...
   8:         Assert.assertEquals(29, gregcal.get(Calendar.DAY_OF_MONTH));
   9:         Assert.assertEquals(2 - 1, gregcal.get(Calendar.MONTH));
  10:         ...
  11:         gregcal.set(Calendar.MONTH, 10);
  12:         Assert.assertEquals("--11-29", gregcal.toString());

View Full Code Here
   1: import java.text.SimpleDateFormat;
   2: import java.util.Calendar;
   3: import java.util.HashMap;
   4:         ...
   5:         {"short", "org.daml.kazuki.Datatypes.getshort"},
   6:         {"java.util.Calendar", "org.daml.kazuki.Datatypes.getCalendar"},
   7:         {"org.daml.kazuki.datatypes.XSDgYear", "org.daml.kazuki.Datatypes.getgYear"},
   8:         ...
   9:     
  10:     public static Calendar getCalendar(Literal l) {
  11:         try {
  12:         ...
  13:             try {
  14:                 return new BigInteger(n.toString());

View Full Code Here