Package org.silverpeas.core.date
Class DateTime
- java.lang.Object
-
- java.util.Date
-
- org.silverpeas.core.date.AbstractDateTemporal<DateTime>
-
- org.silverpeas.core.date.DateTime
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Date>
,Temporal<DateTime>
@Deprecated public class DateTime extends AbstractDateTemporal<DateTime>
Deprecated.Use the java.time APIWARNING: All the deprecated classes in this package contain failure in their handling of date times (bad use of Timezone, etc.) A datetime, expressed in a given timezone. If no timezone is specified explicitly, then the one of the JVM is used by default.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.silverpeas.core.date.Temporal
ICAL_PATTERN, ICAL_UTC_PATTERN, ISO_8601_PATTERN, SHORT_ISO_8601_PATTERN
-
-
Constructor Summary
Constructors Constructor Description DateTime(Date aDate)
Deprecated.Constructs a new datetime from the specified Java date and with the host time zone as time zone.DateTime(Date aDate, TimeZone timeZone)
Deprecated.Constructs a new datetime from the specified Java date and in the specified time zone.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Date
asDate()
Deprecated.Gets the java Date representation of this temporal.DateTime
clone()
Deprecated.Clones itself.static DateTime
dateTimeAt(int... timeParts)
Deprecated.Creates a new datetime from the specified parts of the time specification year month day hour minute second millisecond.boolean
equals(Object obj)
Deprecated.OffsetTime
getOffsetTime()
Deprecated.Gets the time of this datetime by taking into account the offset from UTC/Greenwich in the ISO-8601 calendar system.TimeZone
getTimeZone()
Deprecated.Gets the time zone for which this temporal is defined.int
hashCode()
Deprecated.DateTime
inTimeZone(TimeZone timeZone)
Deprecated.Sets the time zone this temporal is defined for.boolean
isAfter(Date otherDate)
Deprecated.Is the date in this datetime after the specified date.boolean
isAfter(DateTime anotherDatable)
Deprecated.Is this temporal strictly after in time the specified another one?boolean
isBefore(Date otherDate)
Deprecated.Is the date in this datetime before the specified date.boolean
isBefore(DateTime anotherDatable)
Deprecated.Is this temporal strictly before in time the specified another one?boolean
isEqualTo(Date otherDate)
Deprecated.Is the date in this datetime equal to the specified date.boolean
isEqualTo(DateTime anotherDatable)
Deprecated.Is this temporal equal in time to the specified another one?boolean
isTimeSupported()
Deprecated.Is this temporal supports the time unit?protected DateTime
newInstanceFrom(Date aDate)
Deprecated.Create a new instance from a given datetime in milliseconds.static DateTime
now()
Deprecated.Creates a new datetime set at now.Date
toDate()
Deprecated.Converts this datetime to a date.String
toICal()
Deprecated.Gets the ISO 8601 textual representation of this date as it is in the iCal specification.String
toICalInUTC()
Deprecated.Gets the ISO 8601 textual representation of this date as it is in the iCal specification.String
toISO8601()
Deprecated.Gets an ISO 8601 textual representation of this temporal by taking into account of its underlying timezone.String
toShortISO8601()
Deprecated.Gets an ISO 8601 textual representation of this temporal by taking into account of its underlying timezone.ZonedDateTime
toZoneDateTime()
Deprecated.Converts this datetime to aZonedDateTime
instance.-
Methods inherited from class org.silverpeas.core.date.AbstractDateTemporal
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, from, getDate, getDay, getHours, getMinutes, getMonth, getSeconds, getTime, getTimezoneOffset, getYear, parse, setDate, setHours, setMinutes, setMonth, setSeconds, setTime, setYear, toGMTString, toInstant, toLocaleString, toString, UTC
-
-
-
-
Constructor Detail
-
DateTime
public DateTime(Date aDate)
Deprecated.Constructs a new datetime from the specified Java date and with the host time zone as time zone.- Parameters:
aDate
- the Java date from which a datetime is built.
-
-
Method Detail
-
now
public static DateTime now()
Deprecated.Creates a new datetime set at now.- Returns:
- now datetime.
-
dateTimeAt
public static DateTime dateTimeAt(int... timeParts)
Deprecated.Creates a new datetime from the specified parts of the time specification year month day hour minute second millisecond. The hour, minute, second and millisecond parts are optional; if not passed, they are set at 0. For example, the following patterns are valid:- at(2011, 5, 23, 10, 57, 23, 12) meaning in ISO 86601 2011-05-23T10:57:23.012
- at(2011, 5, 23, 10, 57, 23) meaning in ISO 86601 2011-05-23T10:57:23.00
- at(2011, 5, 23, 10, 57) meaning in ISO 86601 2011-05-23T10:57:00.00
- at(2011, 5, 23, 10) meaning in ISO 86601 2011-05-23T10:00:00.00
- at(2011, 5, 23) meaning in ISO 86601 2011-05-23T00:00:00.00
- Parameters:
timeParts
- the different parts of the datetime to set in the following order: year, month, day, hour, minute, second, millisecond. The year, month, and day are mandatory whereas other time parts are optional. If one optional part isn't passed, then it is set to 0.- Returns:
- a datetime matching the specified datetime specification.
-
newInstanceFrom
protected DateTime newInstanceFrom(Date aDate)
Deprecated.Description copied from class:AbstractDateTemporal
Create a new instance from a given datetime in milliseconds.- Specified by:
newInstanceFrom
in classAbstractDateTemporal<DateTime>
- Parameters:
aDate
- the datetime in milliseconds.- Returns:
- the new temporal instance corresponding to the given time in milliseconds.
-
clone
public DateTime clone()
Deprecated.Description copied from interface:Temporal
Clones itself.
-
asDate
public Date asDate()
Deprecated.Description copied from interface:Temporal
Gets the java Date representation of this temporal.- Returns:
- a Date representation of this temporal.
-
toISO8601
public String toISO8601()
Deprecated.Description copied from interface:Temporal
Gets an ISO 8601 textual representation of this temporal by taking into account of its underlying timezone. For datetime, 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 datetime 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 temporal.
-
toShortISO8601
public String toShortISO8601()
Deprecated.Description copied from interface:Temporal
Gets an ISO 8601 textual representation of this temporal by taking into account of its underlying timezone. For datetime, 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 datetime 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 temporal.
-
toICal
public String toICal()
Deprecated.Description copied from interface:Temporal
Gets the ISO 8601 textual representation of this date as it is in the iCal specification. The returned iCal date representation is in this temporal's time zone. In the iCal specification, dates are represented in one of the ISO 8601 format, that is the complete format without any datetime 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 temporal and in the timezone of this temporal.
-
toICalInUTC
public String toICalInUTC()
Deprecated.Description copied from interface:Temporal
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 temporal and in UTC.
-
inTimeZone
public DateTime inTimeZone(TimeZone timeZone)
Deprecated.Description copied from interface:Temporal
Sets the time zone this temporal is defined for. If no time zone is set, then the default one is considered (the timezone of the host). The time zone can have no meaning with some temporal types like for example simple date (day, month, and year).- Parameters:
timeZone
- the time zone of this temporal.- Returns:
- itself.
-
getTimeZone
public TimeZone getTimeZone()
Deprecated.Description copied from interface:Temporal
Gets the time zone for which this temporal is defined.- Returns:
- the time zone of this temporal.
-
isTimeSupported
public boolean isTimeSupported()
Deprecated.Description copied from interface:Temporal
Is this temporal supports the time unit?- Returns:
- true if this temporal supports the time unit. Time and datetime should return true here whereas date should return false.
-
isBefore
public boolean isBefore(DateTime anotherDatable)
Deprecated.Description copied from interface:Temporal
Is this temporal strictly before in time the specified another one?- Parameters:
anotherDatable
- the another temporal to which this is compared.- Returns:
- true if this temporal is strictly before the another one.
-
isAfter
public boolean isAfter(DateTime anotherDatable)
Deprecated.Description copied from interface:Temporal
Is this temporal strictly after in time the specified another one?- Parameters:
anotherDatable
- the another temporal to which this is compared.- Returns:
- true if this temporal is strictly after the another one.
-
isEqualTo
public boolean isEqualTo(DateTime anotherDatable)
Deprecated.Description copied from interface:Temporal
Is this temporal equal in time to the specified another one?- Parameters:
anotherDatable
- the another temporal to which this is compared.- Returns:
- true if this temporal is equal with the another one.
-
isBefore
public boolean isBefore(Date otherDate)
Deprecated.Is the date in this datetime before the specified date.- Parameters:
otherDate
- the other date.- Returns:
- true if the date part of this datetime is before the other date.
-
isAfter
public boolean isAfter(Date otherDate)
Deprecated.Is the date in this datetime after the specified date.- Parameters:
otherDate
- the other date.- Returns:
- true if the date part of this datetime is after the other date.
-
isEqualTo
public boolean isEqualTo(Date otherDate)
Deprecated.Is the date in this datetime equal to the specified date.- Parameters:
otherDate
- the other date.- Returns:
- true if the date part of this datetime is equal to the other date.
-
toDate
public Date toDate()
Deprecated.Converts this datetime to a date. The time part of this datetime is lost.- Returns:
- a date representation of this datetime.
-
toZoneDateTime
public ZonedDateTime toZoneDateTime()
Deprecated.Converts this datetime to aZonedDateTime
instance. The time part as well its timezone is kept.- Returns:
- a zoned datetime representation of this datetime.
-
getOffsetTime
public OffsetTime getOffsetTime()
Deprecated.Gets the time of this datetime by taking into account the offset from UTC/Greenwich in the ISO-8601 calendar system.- Returns:
- the time of this datetime.
-
-