Joda Time API

org.joda.time.gj
Class GJDateOnly

java.lang.Object
  |
  +--org.joda.time.AbstractInstant
        |
        +--org.joda.time.DateOnly
              |
              +--org.joda.time.gj.GJDateOnly
All Implemented Interfaces:
java.lang.Comparable, ReadableInstant, java.io.Serializable

public final class GJDateOnly
extends DateOnly

GJDateOnly is the basic implementation of a date only class using the GJChronology. It holds the date as milliseconds from the Epoch of 1970-01-01T00:00:00Z. There is no time component - the time is always 00:00:00.

Author:
Stephen Colebourne, Brian S O'Neill
See Also:
Serialized Form

Constructor Summary
GJDateOnly()
          Constructs a GJDateOnly to the current date, as reported by the system clock.
GJDateOnly(java.util.Calendar calendar)
          Constructs a GJDateOnly from a Calendar.
GJDateOnly(java.util.Calendar calendar, DateTimeZone zone)
          Constructs a GJDateOnly from a Calendar.
GJDateOnly(java.util.Date date)
          Constructs a GJDateOnly from a Date.
GJDateOnly(java.util.Date date, DateTimeZone zone)
          Constructs a GJDateOnly from a Date.
GJDateOnly(DateTimeZone zone)
          Constructs a GJDateOnly to the current date, as reported by the system clock.
GJDateOnly(long millis)
          Constructs a GJDateOnly set to the milliseconds from 1970-01-01T00:00:00Z.
GJDateOnly(long millis, DateTimeZone zone)
          Constructs a GJDateOnly set to the milliseconds from 1970-01-01T00:00:00Z.
GJDateOnly(ReadableInstant instant)
          Constructs a GJDateOnly from a ReadableInstant.
GJDateOnly(ReadableInstant instant, DateTimeZone zone)
          Constructs a GJDateOnly from a ReadableInstant.
GJDateOnly(java.lang.String str)
          Constructs a GJDateOnly from an ISO formatted String.
GJDateOnly(java.lang.String str, DateTimeZone zone)
          Constructs a GJDateOnly from an ISO formatted String.
 
Methods inherited from class org.joda.time.DateOnly
dayOfMonth, dayOfWeek, dayOfYear, era, getChronology, getDayOfMonth, getDayOfWeek, getDayOfYear, getEra, getLeapYear, getMillis, getMonthOfYear, getWeekOfYearWeek, getWeekOfYearYear, getYear, getYearOfEra, leapYear, monthOfYear, toString, weekOfYearWeek, weekOfYearYear, year, yearOfEra
 
Methods inherited from class org.joda.time.AbstractInstant
compareTo, equals, get, hashCode, isAfter, isBefore, isEqual, toCalendar, toDate, toGregorianCalendar, toInstant
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GJDateOnly

public GJDateOnly()
Constructs a GJDateOnly to the current date, as reported by the system clock. The time zone is set to DateTimeZone.getDefault().


GJDateOnly

public GJDateOnly(DateTimeZone zone)
Constructs a GJDateOnly to the current date, as reported by the system clock. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
zone - the time zone, null is default

GJDateOnly

public GJDateOnly(long millis)
Constructs a GJDateOnly set to the milliseconds from 1970-01-01T00:00:00Z. The time zone is set to DateTimeZone.getDefault().

Parameters:
millis - the milliseconds

GJDateOnly

public GJDateOnly(long millis,
                  DateTimeZone zone)
Constructs a GJDateOnly set to the milliseconds from 1970-01-01T00:00:00Z. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
millis - the milliseconds
zone - the time zone, null is default

GJDateOnly

public GJDateOnly(ReadableInstant instant)
Constructs a GJDateOnly from a ReadableInstant. The time zone is set to DateTimeZone.getDefault().

Parameters:
instant - the ReadableInstant.
Throws:
java.lang.IllegalArgumentException - if the instant is null.

GJDateOnly

public GJDateOnly(ReadableInstant instant,
                  DateTimeZone zone)
Constructs a GJDateOnly from a ReadableInstant. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
instant - the ReadableInstant.
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the instant is null.

GJDateOnly

public GJDateOnly(java.util.Date date)
Constructs a GJDateOnly from a Date. The time zone is set to DateTimeZone.getDefault().

Parameters:
date - the Date
Throws:
java.lang.IllegalArgumentException - if the date is null.

GJDateOnly

public GJDateOnly(java.util.Date date,
                  DateTimeZone zone)
Constructs a GJDateOnly from a Date. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
date - the Date
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if date is null.

GJDateOnly

public GJDateOnly(java.util.Calendar calendar)
Constructs a GJDateOnly from a Calendar. The time zone is set to DateTimeZone.getDefault().

Parameters:
calendar - the Calendar
Throws:
java.lang.IllegalArgumentException - if the calendar is null.

GJDateOnly

public GJDateOnly(java.util.Calendar calendar,
                  DateTimeZone zone)
Constructs a GJDateOnly from a Calendar. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
calendar - the Calendar
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the calendar is null.

GJDateOnly

public GJDateOnly(java.lang.String str)
           throws java.text.ParseException
Constructs a GJDateOnly from an ISO formatted String. The time zone is set to DateTimeZone.getDefault().

Parameters:
str - the string to parse.
Throws:
java.lang.IllegalArgumentException - if the string is null.
java.text.ParseException - if parsing fails.

GJDateOnly

public GJDateOnly(java.lang.String str,
                  DateTimeZone zone)
           throws java.text.ParseException
Constructs a GJDateOnly from an ISO formatted String. If the supplied time zone is null, it is set to DateTimeZone.getDefault().

Parameters:
str - the string to parse.
zone - the time zone, null is default
Throws:
java.lang.IllegalArgumentException - if the string is null.
java.text.ParseException - if parsing fails.

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.