com.silverpeas.calendar
Class Date

java.lang.Object
  extended by java.util.Date
      extended by com.silverpeas.calendar.AbstractDateDatable<Date>
          extended by com.silverpeas.calendar.Date
All Implemented Interfaces:
Datable<Date>, Serializable, Cloneable, Comparable<Date>

public class Date
extends AbstractDateDatable<Date>

A date on a day of a month and in year. The time isn't represented here. Please refers to DateTime to models also the time.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.silverpeas.calendar.Datable
ICAL_PATTERN, ICAL_UTC_PATTERN, ISO_8601_PATTERN, SHORT_ISO_8601_PATTERN
 
Constructor Summary
Date(Date aDate)
          Constructs a new date from the specified Java date.
 
Method Summary
 Date asDate()
          Gets the java Date representation of this datable.
 Date clone()
          Clones itself.
static Date dateOn(int year, int month, int dayOfMonth)
          Creates a date on the specified year in the specified month (1 to 12) and in the specified day (1 to 31).
 boolean equals(Object obj)
           
 TimeZone getTimeZone()
          The time zone has no meaning for a date.
 int hashCode()
           
 Date inTimeZone(TimeZone timeZone)
          The time zone for a date has no meaning.
 boolean isAfter(Date anotherDatable)
          Is this datable strictly after in time the specified another one?
 boolean isBefore(Date anotherDatable)
          Is this datable strictly before in time the specified another one?
 boolean isEqualTo(Date anotherDatable)
          Is this datable equal in time to the specified another one?
protected  Date newInstanceFrom(Date aDate)
          Create a new instance from a given date time in milliseconds.
 Date next()
          The next date to this one.
 Date previous()
          The previous date to this one.
static Date today()
          Creates a date set to today.
 String toICal()
          Gets the ISO 8601 textual representation of this date as it is in the iCal specification.
 String toICalInUTC()
          Gets the ISO 8601 textual representation of this date as it is in the iCal specification.
 String toISO8601()
          Gets an ISO 8601 textual representation of this datable by taking into account of its underlying timezone.
static Date tomorrow()
          Creates a date set to tomorrow.
 String toShortISO8601()
          Gets an ISO 8601 textual representation of this datable by taking into account of its underlying timezone.
static Date yesterday()
          Creates a date set to yesterday.
 
Methods inherited from class com.silverpeas.calendar.AbstractDateDatable
addDays, addHours, addMilliseconds, addMinutes, addMonths, addSeconds, addWeeks, addYears, getBeginOfDay, getBeginOfMonth, getBeginOfWeek, getBeginOfWeek, getBeginOfYear, getEndOfDay, getEndOfMonth, getEndOfWeek, getEndOfWeek, getEndOfYear, getTimeDataTo, isDefined, isNotDefined
 
Methods inherited from class java.util.Date
after, before, compareTo, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toLocaleString, toString, UTC
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Date

public Date(Date aDate)
Constructs a new date from the specified Java date.

Parameters:
aDate - the Java date from which this Silverpeas date is built.
Method Detail

today

public static Date today()
Creates a date set to today.

Returns:
today date.

tomorrow

public static Date tomorrow()
Creates a date set to tomorrow.

Returns:
tomorrow date.

yesterday

public static Date yesterday()
Creates a date set to yesterday.

Returns:
yesterday date.

dateOn

public static Date dateOn(int year,
                          int month,
                          int dayOfMonth)
Creates a date on the specified year in the specified month (1 to 12) and in the specified day (1 to 31).

Parameters:
year - the year.
month - the month (1 for january, 12 for december).
dayOfMonth - the day of month: 1 to 28,29,30,31 according to the month.
Returns:
the date corresponding to the specified date information.

newInstanceFrom

protected Date newInstanceFrom(Date aDate)
Description copied from class: AbstractDateDatable
Create a new instance from a given date time in milliseconds.

Specified by:
newInstanceFrom in class AbstractDateDatable<Date>
Parameters:
aDate - the date time in milliseconds.
Returns:
the new datable instance corresponding to the given time in milliseconds.

clone

public Date clone()
Description copied from interface: Datable
Clones itself.

Specified by:
clone in interface Datable<Date>
Specified by:
clone in class AbstractDateDatable<Date>
Returns:
a clone to this datable.

asDate

public Date asDate()
Description copied from interface: Datable
Gets the java Date representation of this datable.

Returns:
a Date representation of this datable.

inTimeZone

public Date inTimeZone(TimeZone timeZone)
The time zone for a date has no meaning.

Parameters:
timeZone - the time zone to set to this date.?
Returns:
itself.

toISO8601

public String toISO8601()
Description copied from interface: Datable
Gets an ISO 8601 textual representation of this datable by taking into account of its underlying timezone. For date and time, the representation is at the accuracy to the second. The ISO 8601 format in which the date is returned is one of the more common in the Web, that is with the date and time separators (the hyphen for dates and the double-points for times): yyyy-MM-dd'T'HH:mm:ss where yyyy means the year in 4 digits, MM means the month in year in two digits, dd means the day in month in two digits, HH means the hour (24-o'clock) in two digits, mm means the minute in two digits, and ss the second in two digits.

Returns:
the ISO 8601 textual representation of this datable.

toShortISO8601

public String toShortISO8601()
Description copied from interface: Datable
Gets an ISO 8601 textual representation of this datable by taking into account of its underlying timezone. For date and time, the representation is at the accuracy to the minute. The ISO 8601 format in which the date is returned is one of the more common in the Web, that is with the date and time separators (the hyphen for dates and the double-points for times): yyyy-MM-dd'T'HH:mm:ss where yyyy means the year in 4 digits, MM means the month in year in two digits, dd means the day in month in two digits, HH means the hour (24-o'clock) in two digits, and mm means the minute in two digits.

Returns:
a short ISO 8601 textual representation of this datable.

toICal

public String toICal()
Description copied from interface: Datable
Gets the ISO 8601 textual representation of this date as it is in the iCal specification. The returned iCal date representation is in this datable's time zone. In the iCal specification, dates are represented in one of the ISO 8601 format, that is the complete format without any date and time separators (the hyphen character for dates and the double-points for times). In the iCal specification, no time zone information is added to the ISO 8601 representation of the date, nevertheless when the date is indicated in UTC, the 'Z' marker must be set in the date as required by the ISO 8601 standard.

Returns:
the iCal textual representation of this datable and in the timezone of this datable.

toICalInUTC

public String toICalInUTC()
Description copied from interface: Datable
Gets the ISO 8601 textual representation of this date as it is in the iCal specification. The returned iCal date representation is in explicitly set in UTC. In the iCal specification, dates are represented in one of the ISO 8601 format, that is the complete format without any date and time separators (the hyphen character for dates and the double-points for times). In the iCal specification, no time zone information is added to the ISO 8601 representation of the date, nevertheless when the date is indicated in UTC, the 'Z' marker must be set in the date as required by the ISO 8601 standard.

Returns:
the iCal textual representation of this datable and in UTC.

getTimeZone

public TimeZone getTimeZone()
The time zone has no meaning for a date.

Returns:
the time zone in which this date is set.

next

public Date next()
The next date to this one.

Returns:
the day after this one.

previous

public Date previous()
The previous date to this one.

Returns:
the day preceding this one.

isBefore

public boolean isBefore(Date anotherDatable)
Description copied from interface: Datable
Is this datable strictly before in time the specified another one?

Parameters:
anotherDatable - the another datable to which this is compared.
Returns:
true if this datable is strictly before the another one.

isAfter

public boolean isAfter(Date anotherDatable)
Description copied from interface: Datable
Is this datable strictly after in time the specified another one?

Parameters:
anotherDatable - the another datable to which this is compared.
Returns:
true if this datable is strictly after the another one.

isEqualTo

public boolean isEqualTo(Date anotherDatable)
Description copied from interface: Datable
Is this datable equal in time to the specified another one?

Parameters:
anotherDatable - the another datable to which this is compared.
Returns:
true if this datable is equal with the another one.

equals

public boolean equals(Object obj)
Overrides:
equals in class Date

hashCode

public int hashCode()
Overrides:
hashCode in class Date


Copyright © 2016 Silverpeas. All Rights Reserved.