Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | 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

public class Date
extends Month
implements java.io.Serializable, java.lang.Cloneable, java.lang.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

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, java.util.TimeZone timeZone)` Constructs a new Date for the given year, month, date and timezone.

Method Summary
`java.lang.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(java.lang.Object anotherObject)` Compares this Date with another object.
`static Date` | `createDate()` Returns a Date instance for today.
`static Date` | `createDate(java.util.Date date)` Given a java.util.Date, returns a Date instance.
`static Date` | `createDate(long year, int month, int day, java.util.TimeZone timeZone)` Given the given year, month, date and timezone, returns a Date instance.
`static Date` | `createDate(java.lang.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
`java.sql.Date` | `toSQLDate()` Returns a `java.sql.Date` equivalent.
`java.lang.String` | `toString()` Returns a XML schema compliant date string.
`java.lang.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,
                   java.util.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
    `timezone` - the timezone. May be null if local.

Method Detail

### createDate

    public static Date createDate()

  Returns a Date instance for today.

  Returns:
    instance of Date

### createDate

    public static Date createDate(java.lang.String date)
                           throws java.text.ParseException

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

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

### createDate

    public static Date createDate(java.util.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,
                                  java.util.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
    `timezone` - the timezone. May be null if local.
  Returns:
    instance of Date

### getDay

    public int getDay()

  Returns the day (DD) field

  Returns:
    the day

### setDay

    public void setDay(int day)
                throws java.lang.IllegalArgumentException

  Sets the month (DD) field

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

### toUTC

    public java.lang.Object toUTC()

  Offsets the current date instant to UTC.

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

### clone

    public java.lang.Object clone()

  Returns a copy of this date.

  Returns:
    copy
  Overrides:
    clone in class Month

### 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:
    java.lang.IllegalArgumentException - thrown when the argument is represented in a different time zone.

### compareTo

    public int compareTo(java.lang.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 java.lang.Comparable

  Parameters:
    `object` - the 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:
    java.lang.ClassCastException - thrown if the argument is not an instance of Date.
  Overrides:
    compareTo in class Month

### toString

    public java.lang.String toString()

  Returns a XML schema compliant date string.

  Returns:
    string value
  Overrides:
    toString in class Month

### toSQLDate

    public java.sql.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
| © 2002 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 BEA Systems, Inc. All Rights Reserved