Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.xml.schema
Class Date

    java.lang.Object
      com.bea.p13n.xml.schema.Century
          com.bea.p13n.xml.schema.Year
              com.bea.p13n.xml.schema.Month
                  com.bea.p13n.xml.schema.Date

All Implemented Interfaces:
  Cloneable, Comparable, Serializable

public class Date
extends Month
implements Serializable, Cloneable, Comparable

This class provides the Java biding for the XML schema type date as specified in Section 3.3.27 of XML Schema Part 2: Datatypes.

date represents a specific period of time that starts at midnight and lasts until the mignight the following day.

The value space of month is the set of Gregorian calendar dates specified as CCYY-MM-DD.

Example: `2001-01-01`.

See Also:
  Serialized Form

Field Summary

Fields inherited from class com.bea.p13n.xml.schema.Century
`_internal`

Constructor Summary
`protected` | `Date()` Constructs a new Date instance.
`protected` | `Date(long year, int month, int day, TimeZone timeZone)` Constructs a new Date for the given year, month, date and timezone.

Method Summary
`Object` | `clone()` Returns a copy of this date.
`int` | `compareTo(Date anotherDate)` Compares this Date to another Date object (represented in the same time zone) in their canonical representation.
`int` | `compareTo(Object anotherObject)` Compares this Date with another object.
`static Date` | `createDate()` Returns a Date instance for today.
`static Date` | `createDate(Date date)` Given a java.util.Date, returns a Date instance.
`static Date` | `createDate(long year, int month, int day, TimeZone timeZone)` Given the given year, month, date and timezone, returns a Date instance.
`static Date` | `createDate(String date)` Given a string of the form CCYY-MM-DD, returns a Date instance.
`int` | `getDay()` Returns the day (DD) field
`void` | `setDay(int day)` Sets the month (DD) field
`Date` | `toSQLDate()` Returns a `java.sql.Date` equivalent.
`String` | `toString()` Returns a XML schema compliant date string.
`Object` | `toUTC()` Offsets the current date instant to UTC.

Methods inherited from class com.bea.p13n.xml.schema.Month
`compareTo, createMonth, createMonth, getMonth, setMonth`

Methods inherited from class com.bea.p13n.xml.schema.Year
`compareTo, createYear, createYear, getYear, setYear, setYear`

Methods inherited from class com.bea.p13n.xml.schema.Century
`compareTo, createCentury, createCentury, getCentury, getEra, getTimeZone, setCentury, setEra, setTimeZone, setTimeZone`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Date

    protected Date()

  Constructs a new Date instance.

### Date

    protected Date(long year,
                   int month,
                   int day,
                   TimeZone timeZone)

  Constructs a new Date for the given year, month, date and timezone.

Parameters:
  `year` - the year (CCYY) field
  `month` - the month (MM) field
  `day` - the day (DD) field

Method Detail

### createDate

    public static Date createDate()

  Returns a Date instance for today.

  Returns:
    instance of Date

### createDate

    public static Date createDate(String date)
                           throws ParseException

  Given a string of the form CCYY-MM-DD, returns a Date instance.

  Returns:
    instance of Date
  Throws:
    `ParseException` - thrown due to illegal string argument.

### createDate

    public static Date createDate(Date date)

  Given a java.util.Date, returns a Date instance.

  Parameters:
    `date` - date
  Returns:
    instance of Date

### createDate

    public static Date createDate(long year,
                                  int month,
                                  int day,
                                  TimeZone timeZone)

  Given the given year, month, date and timezone, returns a Date instance.

  Parameters:
    `year` - the year (CCYY) field
    `month` - the month (MM) field
    `day` - the day (DD) field
  Returns:
    instance of Date

### getDay

    public int getDay()

  Returns the day (DD) field

  Returns:
    the day

### setDay

    public void setDay(int day)
                throws IllegalArgumentException

  Sets the month (DD) field

  Parameters:
    `day` - the day (DD)
  Throws:
    `IllegalArgumentException` - thrown when the day argument is illegal

### toUTC

    public Object toUTC()

  Offsets the current date instant to UTC.

  Overrides:
    `toUTC` in class `Month`
  Returns:
    instance of Date offset to UTC

### clone

    public Object clone()

  Returns a copy of this date.

  Overrides:
    `clone` in class `Month`
  Returns:
    copy

### compareTo

    public int compareTo(Date anotherDate)

  Compares this Date to another Date object (represented in the same time zone) in their canonical representation.

  Parameters:
    `anotherDate` - another Date object to be compared.
  Returns:
    the value 0 if the argument Date is equal to this Date; a value less than 0 if this Date is before the Date argument; and a value greater than 0 if this Date is after the Date argument.
  Throws:
    `IllegalArgumentException` - thrown when the argument is represented in a different time zone.

### compareTo

    public int compareTo(Object anotherObject)

  Compares this Date with another object. If the other object is a Date, this method behaves like compareTo(Date). Otherwise, it throws a ClassCastException.

  Specified by:
    `compareTo` in interface `Comparable`
  Overrides:
    `compareTo` in class `Month`
  Returns:
    the value 0 if the argument Date is equal to this Date; a value less than 0 if this Date is before the Date argument; and a value greater than 0 if this Date is after the Date argument.
  Throws:
    `ClassCastException` - thrown if the argument is not an instance of Date.

### toString

    public String toString()

  Returns a XML schema compliant date string.

  Overrides:
    `toString` in class `Month`
  Returns:
    string value

### toSQLDate

    public Date toSQLDate()

  Returns a `java.sql.Date` equivalent. Note that this operation excludes any timezone.

  Returns:
    java.sql.Date

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2004 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 BEA Systems, Inc. All Rights Reserved