Package com.documentum.fc.common

# Class DfTime

java.lang.Object
com.documentum.fc.common.DfObject
com.documentum.fc.common.DfTime

All Implemented Interfaces:
  `IDfTime`, `Externalizable`, `Serializable`

public final class DfTime extends com.documentum.fc.common.DfObject implements IDfTime, Externalizable
An implementation of the IDfTime interface.

See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final DfTime`
  `DF_INVALIDDATE`
  `static final String`
  `DF_INVALIDDATE_STR`
  `static final DfTime`
  `DF_NULLDATE`
  `static final String`
  `DF_NULLDATE_STR`

  ### Fields inherited from interface com.documentum.fc.common.IDfTime

  `DF_TIME_PATTERN_DEFAULT, DF_TIME_PATTERN1, DF_TIME_PATTERN10, DF_TIME_PATTERN11, DF_TIME_PATTERN12, DF_TIME_PATTERN13, DF_TIME_PATTERN14, DF_TIME_PATTERN15, DF_TIME_PATTERN16, DF_TIME_PATTERN17, DF_TIME_PATTERN18, DF_TIME_PATTERN19, DF_TIME_PATTERN2, DF_TIME_PATTERN20, DF_TIME_PATTERN21, DF_TIME_PATTERN22, DF_TIME_PATTERN23, DF_TIME_PATTERN24, DF_TIME_PATTERN25, DF_TIME_PATTERN26, DF_TIME_PATTERN27, DF_TIME_PATTERN28, DF_TIME_PATTERN29, DF_TIME_PATTERN3, DF_TIME_PATTERN30, DF_TIME_PATTERN31, DF_TIME_PATTERN32, DF_TIME_PATTERN33, DF_TIME_PATTERN34, DF_TIME_PATTERN35, DF_TIME_PATTERN36, DF_TIME_PATTERN37, DF_TIME_PATTERN38, DF_TIME_PATTERN39, DF_TIME_PATTERN4, DF_TIME_PATTERN40, DF_TIME_PATTERN41, DF_TIME_PATTERN42, DF_TIME_PATTERN43, DF_TIME_PATTERN44, DF_TIME_PATTERN45, DF_TIME_PATTERN46, DF_TIME_PATTERN5, DF_TIME_PATTERN6, DF_TIME_PATTERN7, DF_TIME_PATTERN8, DF_TIME_PATTERN9`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DfTime()`
  Creates a new DfTime object initialized to the current date.
  `DfTime(String dateString)`
  Creates a new instance initialized to the specified date where the date is specified in a string form.
  `DfTime(String dateString, String pattern)`
  Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).
  `DfTime(String dateString, String pattern, boolean interpretAsJavaPatternOnlyIgnored)`
  Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).
  `DfTime(String dateString, DateFormat format)`
  Creates a new instance initialized to the specified date where the date is specified in a string form.
  `DfTime(Date date)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `asString(String pattern)`
  Returns the date/time formatted according to the specified pattern.
  `int`
  `compareTo(IDfTime object)`
  Returns 1 if this date/time is later than the argument "time"; 0 if the two date/times are the same; or -1 if this date/time object represents an older time than the argument.
  `boolean`
  `equals(Object o)`
  Returns `true` if the argument is a DfTime object that represents the same date/time as this object.
  `final Date`
  `getDate()`
  Returns the date as a Java Date.
  `int`
  `getDay()`
  Returns the day portion of the date as an integer (e.g., 28).
  `int`
  `getHour()`
  Returns the hour portion of the date as an integer.
  `int`
  `getMinutes()`
  Returns the minutes portion of the date as an integer.
  `int`
  `getMonth()`
  Returns the month portion of the date as an integer (e.g., 12).
  `String`
  `getPattern()`
  Returns the pattern string used to format the date/time.
  `int`
  `getSeconds()`
  Returns the seconds portion of the date as an integer.
  `int`
  `getYear()`
  Returns the year portion of the date as an integer (e.g., 1998).
  `int`
  `hashCode()`
  `static boolean`
  `isKnownServerPattern(String pattern)`
  Indicates whether the given date pattern is one of the known builtin server data patterns.
  `final boolean`
  `isNullDate()`
  Indicates whether this object represents a NULLDATE.
  `boolean`
  `isValid()`
  Indicates whether the underlying date string has a valid format.
  `static boolean`
  `isValidPattern(String pattern)`
  Indicates if the given date pattern is valid for use with DfTime.
  `void`
  `readExternal(ObjectInput in)`
  `String`
  `toString()`
  Returns the time string used to construct the DfTime object, or, if the DfTime object was constructed with a Java Date object, the result of formatting the date/time using DF_TIME_PATTERN_DEFAULT.
  `static DfTime`
  `valueOf(String string)`
  Returns a `DfTime` with a value represented by the specified String.
  `void`
  `writeExternal(ObjectOutput out)`

  ### Methods inherited from class com.documentum.fc.common.DfObject

  `getClassName, getStringRep, trace, trace, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPI, traceAPIExit, traceAPIExit, traceAPIExit, traceAPIExit, traceAPIExit, traceAPIExit, traceAPIExit, traceAPIExit, traceNoName`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DF_NULLDATE_STR

    public static final String DF_NULLDATE_STR
    See Also:
      - Constant Field Values

  - ### DF_NULLDATE

    public static final DfTime DF_NULLDATE

  - ### DF_INVALIDDATE_STR

    public static final String DF_INVALIDDATE_STR
    See Also:
      - Constant Field Values

  - ### DF_INVALIDDATE

    public static final DfTime DF_INVALIDDATE

- ## Constructor Details

  - ### DfTime

    public DfTime()
    Creates a new DfTime object initialized to the current date.

  - ### DfTime

    public DfTime(Date date)

  - ### DfTime

    public DfTime(String dateString)
    Creates a new instance initialized to the specified date where the date is specified in a string form.

    The default Java format for the current locale is used to parse the date string.

  - ### DfTime

    public DfTime(String dateString, String pattern)
    Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).

    The date string is parsed using the given pattern. The pattern can be one of the pre-defined IDfTime patterns or a java date pattern, with the former taking precedence. It's highly recommended that if using a java pattern, use the `DfTime(String, String, boolean)` constructor.

  - ### DfTime

    public DfTime(String dateString, String pattern, boolean interpretAsJavaPatternOnlyIgnored)
    Creates a new instance initialized to the specified date where the date is specified in a String form and is parsed using the given pattern (also specified in String form).

    The date string is parsed using the given pattern. If `interpretAsJavaPatternOnly` is true then the given pattern is interpretted as a Java pattern; otherwise calling this constructor is equivalent to calling `DfTime(String, String)` which means the pattern could be either a Docbase date pattern or a Java date pattern.
    Parameters:
      `dateString` - The date string to parse.
      `pattern` - The pattern to use to parse the date string.
      `interpretAsJavaPatternOnlyIgnored` -
    Since:
      5.2

  - ### DfTime

    public DfTime(String dateString, DateFormat format)
    Creates a new instance initialized to the specified date where the date is specified in a string form.

    The date string is parsed using the given format.

- ## Method Details

  - ### valueOf

    public static DfTime valueOf(String string)
    Returns a `DfTime` with a value represented by the specified String.
    Parameters:
      `string` - a string.
    Returns:
      the `DfTime` value represented by the string.

  - ### isValidPattern

    public static boolean isValidPattern(String pattern)
    Indicates if the given date pattern is valid for use with DfTime.
    Parameters:
      `pattern` - The pattern to use to parse or format the date string.

  - ### compareTo

    public int compareTo(IDfTime object)
    Description copied from interface: `IDfTime`
    Returns 1 if this date/time is later than the argument "time"; 0 if the two date/times are the same; or -1 if this date/time object represents an older time than the argument. For the sake of this comparison, invalid times come before valid times so the result of `myNullTime.compareTo(myInvalidTime)` would be 1 (myNullTime is bigger). If both this DfTime object and the argument represent invalid times, 0 is returned. Otherwise, NULLDATEs always preceed any valid time.
    Specified by:
      `compareTo` in interface `IDfTime`
    Parameters:
      `object` - a DfTime object
    Returns:
      return 1 if this date/time is later than the argument "time"; 0, if the two date/times are the same; or -1 if this date/time object represents an older time than the argument.

  - ### equals

    public boolean equals(Object o)
    Description copied from interface: `IDfTime`
    Returns `true` if the argument is a DfTime object that represents the same date/time as this object. This method returns `false` if the two date/times are different, if the argument is not of type DfTime, or if either this object or the argument does not represent a valid time. Note: This method returns a value of true if the method’s argument represents a time that is within one second of the time that the object represents.
    Specified by:
      `equals` in interface `IDfTime`
    Overrides:
      `equals` in class `Object`
    Parameters:
      `o` - a DfTime object
    Returns:
      `true` if argument is a DfTime object that represents the same date/time as this object.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### asString

    public String asString(String pattern)
    Description copied from interface: `IDfTime`
    Returns the date/time formatted according to the specified pattern. If this string was not returned from the server and if the pattern argument is not one of the 45 patterns defined in IDfTime, the string returned will be formatted using the default pattern. If the string was constructed on the client side and it was constructed with a `null` string argument or the string "NULLDATE", returns `null`.
    Specified by:
      `asString` in interface `IDfTime`
    Parameters:
      `pattern` - a Documentum date/time pattern string. See the comments for the constructor DfTime(String, String). for a listing of the legal patterns.
    Returns:
      the date formatted

  - ### toString

    public String toString()
    Description copied from interface: `IDfTime`
    Returns the time string used to construct the DfTime object, or, if the DfTime object was constructed with a Java Date object, the result of formatting the date/time using DF_TIME_PATTERN_DEFAULT.
    Specified by:
      `toString` in interface `IDfTime`
    Overrides:
      `toString` in class `Object`
    Returns:
      the internal time string.

  - ### getDate

    public final Date getDate()
    Description copied from interface: `IDfTime`
    Returns the date as a Java Date.
    Specified by:
      `getDate` in interface `IDfTime`
    Returns:
      the date as a Java date. This will be `null` under the following conditions: 1) the object was constructed with a `null` date string or if that string equals "nullstring" (ignoring case); 2) the object was constructed with a date string that could not be parsed with the provided pattern string (or with the default pattern string if no pattern string was provided).

  - ### getDay

    public int getDay()
    Description copied from interface: `IDfTime`
    Returns the day portion of the date as an integer (e.g., 28). If the underlying date is a "nulldate", then 0 is returned. If the information is not contained in the time object (e.g. it was constructed with the year only: DfTime("1998", yyyy)), 1 is returned.
    Specified by:
      `getDay` in interface `IDfTime`
    Returns:
      the day portion of the date as an integer.

  - ### getHour

    public int getHour()
    Description copied from interface: `IDfTime`
    Returns the hour portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned.
    Specified by:
      `getHour` in interface `IDfTime`
    Returns:
      the hour portion of the date as an integer.

  - ### getMinutes

    public int getMinutes()
    Description copied from interface: `IDfTime`
    Returns the minutes portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned.
    Specified by:
      `getMinutes` in interface `IDfTime`
    Returns:
      the minutes portion of the date as an integer.

  - ### getMonth

    public int getMonth()
    Description copied from interface: `IDfTime`
    Returns the month portion of the date as an integer (e.g., 12). If the underlying date is a "nulldate", then 0 is returned. If the information is not contained in the time object (e.g. it was constructed with the year only: DfTime("1998", yyyy)), 1 is returned.
    Specified by:
      `getMonth` in interface `IDfTime`
    Returns:
      the month portion of the date as an integer.

  - ### getSeconds

    public int getSeconds()
    Description copied from interface: `IDfTime`
    Returns the seconds portion of the date as an integer. If the underlying date is a "nulldate" or the DfTime object was created without time information, 0 is returned.
    Specified by:
      `getSeconds` in interface `IDfTime`
    Returns:
      the seconds portion of the date as an integer.

  - ### getYear

    public int getYear()
    Description copied from interface: `IDfTime`
    Returns the year portion of the date as an integer (e.g., 1998). If the underlying date is a "nulldate" or has an invalid format, then 0 is returned.
    Specified by:
      `getYear` in interface `IDfTime`
    Returns:
      the year portion of the date as an integer.

  - ### isValid

    public boolean isValid()
    Description copied from interface: `IDfTime`
    Indicates whether the underlying date string has a valid format. There is some overhead connected with calling this method since it will attempt to parse the string if it has not done so already.
    Specified by:
      `isValid` in interface `IDfTime`
    Returns:
      `true` if this contains a valid date/time string.

  - ### isNullDate

    public final boolean isNullDate()
    Description copied from interface: `IDfTime`
    Indicates whether this object represents a NULLDATE.
    Specified by:
      `isNullDate` in interface `IDfTime`
    Returns:
      `true` if the value of the DfTime object is "nulldate" or if the DfTime object was constructed with a `null` string.

  - ### getPattern

    public String getPattern()
    Description copied from interface: `IDfTime`
    Returns the pattern string used to format the date/time. If the constructor DfTime(String date, String pattern) was used to create this DfTime object, this method returns pattern argument passed to that constructor. If one of the other constructors was used, this method returns the pattern DF_TIME_PATTERN_DEFAULT.
    Specified by:
      `getPattern` in interface `IDfTime`
    Returns:
      the pattern used to format this date/time.

  - ### isKnownServerPattern

    public static boolean isKnownServerPattern(String pattern)
    Indicates whether the given date pattern is one of the known builtin server data patterns.
    Parameters:
      `pattern` - a data pattern string
    Returns:
      an indication of whether the given date pattern is one of the known builtin server data patterns.

  - ### writeExternal

    public void writeExternal(ObjectOutput out) throws IOException
    Specified by:
      `writeExternal` in interface `Externalizable`
    Throws:
      `IOException`

  - ### readExternal

    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
    Specified by:
      `readExternal` in interface `Externalizable`
    Throws:
      `IOException`
      `ClassNotFoundException`