com.genesyslab.wfm8.API.util

## Class OleDateTime

- java.lang.Object
- - com.genesyslab.wfm8.API.util.OleDateTime

- All Implemented Interfaces:
    java.lang.Comparable

      public class OleDateTime
      extends java.lang.Object
      implements java.lang.Comparable

  OleDateTime is used with WFM API to represent a date/time value with no time zone or daylight saving time information attached. It is based on a floating-point (double) value, measuring days from midnight, 30 December 1899. So, midnight, 31 December 1899 is represented by 1.0. Similarly, 6 AM, 1 January 1900 is represented by 2.25, and midnight, 29 December 1899 is - 1.0. This type is also used to represent date-only or time-only values. By convention, the date 0 (30 December 1899) is used for time-only values. Similarly, the time 0:00 (midnight) is used for date-only values. NOTE: If you are using .NET Framework, use the DateTime.ToOADate() and DateTime.FromOADate() methods instead.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `private static class` | `OleDateTime.TM`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int[]` | `_monthDays`
    `private static double` | `HALF_SECOND`
    `private double` | `m_dt`
    `private int` | `m_status`
    `private static int` | `MAX_DATE`
    `private static int` | `MIN_DATE`
    `private static double` | `OLE_DATETIME_HALFSECOND`
    `static int` | `STATUS_ERROR`
    `static int` | `STATUS_INVALID`
    `static int` | `STATUS_NULL`
    `static int` | `STATUS_VALID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OleDateTime()` Creates a new instance of OleDateTime having a NULL value
    `OleDateTime(java.util.Calendar c)` Creates a new instance of OleDateTime from a Calendar value Note that any time zone information in the Calendar is lost
    `OleDateTime(double dt)` Creates a new instance of OleDateTime based on a "double" value
    `OleDateTime(int wHour, int wMinute)` Creates a new instance of OleDateTime given time information only
    `OleDateTime(int wYear, int wMonth, int wDay)` Creates a new instance of OleDateTime given date information only
    `OleDateTime(int wYear, int wMonth, int wDay, int wHour, int wMinute)` Creates a new instance of OleDateTime given date and time information

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `private static OleDateTime.TM` | `_TmFromOleDate(double dtSrc)`
    `OleDateTime` | `addDateTimeSpan(int days, int hours, int mins)` Adds a day/time span to a date/time value
    `double` | `asDouble()` Returns a floating-point value that OleDateTime is based on
    `java.util.Calendar` | `asGMTCalendar()` Converts OleDateTime value to a Calendar value.
    `private long` | `asLong()`
    `static double` | `Calendar2Double(java.util.Calendar cSrc)` Converts a Calendar value to a floating-point value that represents an OleDateTime value.
    `static int` | `compare(double d1, double d2)` Compares two double values representing OleDateTime
    `int` | `compareTo(java.lang.Object o)` Compares two OleDateTime values
    `static int` | `diffMinutes(OleDateTime t1, OleDateTime t2)` Calculates the number of minutes between two date/time values
    `static java.util.Calendar` | `Double2GMTCalendar(double dSrc)` Creates a Calendar value from the given floating-point value that OleDateTime is based on.
    `boolean` | `equals(java.lang.Object obj)`
    `OleDateTime` | `getDate()` Returns Date part of a date/time value
    `int` | `getDay()` Returns day of month (0-31)
    `int` | `getDayOfWeek()` Returns day of week, where 1=Sun, 2=Mon, ..., 7=Sat
    `int` | `getDayOfYear()` Returns number of days since start of year, Jan 1 = 1
    `int` | `getHour()` Returns hour in day (0-23)
    `int` | `getMinute()` Returns minute in hour (0-59)
    `int` | `getMonth()` Returns month of year (1 = Jan)
    `int` | `getStatus()` Returns status
    `OleDateTime` | `getTime()` Returns Time part of a date/time value
    `int` | `getYear()` Returns Year from 1899 to 9999
    `int` | `hashCode()`
    `void` | `ReadFromStream(java.io.DataInputStream s)` Reads OleDateTime value from stream
    `int` | `setDateTime(int wYear, int wMonth, int wDay, int wHour, int wMinute)` Sets a new date/time value for an existing OleDateTime instance
    `void` | `setStatus(int status)` Sets status
    `int` | `setTime(int wHour, int wMinute)` Sets a new time value for an existing OleDateTime instance
    `OleDateTime` | `substractDateTimeSpan(int days, int hours, int mins)` Subtracts a day/time span from a date/time value
    `java.lang.String` | `toDateString()` Returns Date part of OleDateTime as a human-readable string value
    `java.lang.String` | `toDateTimeString()`
    `java.lang.String` | `toTimeString()` Returns Time part of OleDateTime as a human-readable string value
    `void` | `WriteToStream(java.io.DataOutputStream s)` Writes OleDateTime value to stream

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

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

- - ### Field Detail

    - #### STATUS_ERROR

          public static final int STATUS_ERROR

      See Also:
        Constant Field Values

    - #### STATUS_VALID

          public static final int STATUS_VALID

      See Also:
        Constant Field Values

    - #### STATUS_INVALID

          public static final int STATUS_INVALID

      See Also:
        Constant Field Values

    - #### STATUS_NULL

          public static final int STATUS_NULL

      See Also:
        Constant Field Values

    - #### m_dt

          private double m_dt

    - #### m_status

          private int m_status

    - #### OLE_DATETIME_HALFSECOND

          private static final double OLE_DATETIME_HALFSECOND

      See Also:
        Constant Field Values

    - #### HALF_SECOND

          private static final double HALF_SECOND

      See Also:
        Constant Field Values

    - #### _monthDays

          private static final int[] _monthDays

    - #### MIN_DATE

          private static final int MIN_DATE

      See Also:
        Constant Field Values

    - #### MAX_DATE

          private static final int MAX_DATE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OleDateTime

          public OleDateTime()

      Creates a new instance of OleDateTime having a NULL value

    - #### OleDateTime

          public OleDateTime(double dt)

      Creates a new instance of OleDateTime based on a "double" value
      Parameters:
        `dt` - Number of days (with fraction) passed since 12/30/1899

    - #### OleDateTime

          public OleDateTime(int wYear,
                     int wMonth,
                     int wDay,
                     int wHour,
                     int wMinute)

      Creates a new instance of OleDateTime given date and time information
      Parameters:
        `wYear` - Year from 1899 to 9999
        `wMonth` - Month of year (1 = Jan)
        `wDay` - Day of month (0-31)
        `wHour` - Hour in day (0-23)
        `wMinute` - Minute in hour (0-59)

    - #### OleDateTime

          public OleDateTime(int wYear,
                     int wMonth,
                     int wDay)

      Creates a new instance of OleDateTime given date information only
      Parameters:
        `wYear` - Year from 1899 to 9999
        `wMonth` - Month of year (1 = Jan)
        `wDay` - Day of month (0-31)

    - #### OleDateTime

          public OleDateTime(int wHour,
                     int wMinute)

      Creates a new instance of OleDateTime given time information only
      Parameters:
        `wHour` - Hour in day (0-23)
        `wMinute` - Minute in hour (0-59)

    - #### OleDateTime

          public OleDateTime(java.util.Calendar c)

      Creates a new instance of OleDateTime from a Calendar value Note that any time zone information in the Calendar is lost
      Parameters:
        `c` - Calendar value to construct from

  - ### Method Detail

    - #### Double2GMTCalendar

          public static java.util.Calendar Double2GMTCalendar(double dSrc)

      Creates a Calendar value from the given floating-point value that OleDateTime is based on. Note that time zone for the Calendar object is pre-set to GMT time zone because the OleDateTime value doesn't include any time zone or daylight saving time information
      Parameters:
        `dSrc` - Floating-point value representing the OleDateTime value
      Returns:
        Newly constructed Calendar value with GMT time zone

    - #### Calendar2Double

          public static double Calendar2Double(java.util.Calendar cSrc)

      Converts a Calendar value to a floating-point value that represents an OleDateTime value. Note, that any time zone information in the Calendar is lost after conversion
      Parameters:
        `cSrc` - Calendar value to convert
      Returns:
        Floating-point value that represents the OleDateTime value.

    - #### asGMTCalendar

          public java.util.Calendar asGMTCalendar()

      Converts OleDateTime value to a Calendar value. Note that the time zone for the Calendar object is pre-set to GMT time zone because the OleDateTime value doesn't include any time zone or daylight saving time information
      Returns:
        Corresponding Calendar value with GMT time zone attached

    - #### asDouble

          public double asDouble()

      Returns a floating-point value that OleDateTime is based on
      Returns:
        Floating-point value that OleDateTime is based on

    - #### getStatus

          public int getStatus()

      Returns status
      Returns:
        Status: STATUS_ERROR, STATUS_VALID, STATUS_INVALID or STATUS_NULL

    - #### setStatus

          public void setStatus(int status)

      Sets status
      Parameters:
        `status` - STATUS_ERROR, STATUS_VALID, STATUS_INVALID or STATUS_NULL

    - #### getYear

          public int getYear()

      Returns Year from 1899 to 9999
      Returns:
        Year from 1899 to 9999

    - #### getMonth

          public int getMonth()

      Returns month of year (1 = Jan)
      Returns:
        Month of year (1 = Jan)

    - #### getDay

          public int getDay()

      Returns day of month (0-31)
      Returns:
        Day of month (0-31)

    - #### getHour

          public int getHour()

      Returns hour in day (0-23)
      Returns:
        Hour in day (0-23)

    - #### getMinute

          public int getMinute()

      Returns minute in hour (0-59)
      Returns:
        Minute in hour (0-59)

    - #### getDayOfWeek

          public int getDayOfWeek()

      Returns day of week, where 1=Sun, 2=Mon, ..., 7=Sat
      Returns:
        Day of week, where 1=Sun, 2=Mon, ..., 7=Sat

    - #### getDayOfYear

          public int getDayOfYear()

      Returns number of days since start of year, Jan 1 = 1
      Returns:
        Days since start of year, Jan 1 = 1

    - #### setDateTime

          public int setDateTime(int wYear,
                        int wMonth,
                        int wDay,
                        int wHour,
                        int wMinute)

      Sets a new date/time value for an existing OleDateTime instance
      Parameters:
        `wYear` - Year from 1899 to 9999
        `wMonth` - Month of year (1 = Jan)
        `wDay` - Day of month (0-31)
        `wHour` - Hour in day (0-23)
        `wMinute` - Minute in hour (0-59)
      Returns:
        Status: STATUS_ERROR, STATUS_VALID, STATUS_INVALID or STATUS_NULL

    - #### setTime

          public int setTime(int wHour,
                    int wMinute)

      Sets a new time value for an existing OleDateTime instance
      Parameters:
        `wHour` - Hour in day (0-23)
        `wMinute` - Minute in hour (0-59)
      Returns:
        Status: STATUS_ERROR, STATUS_VALID, STATUS_INVALID or STATUS_NULL

    - #### getTime

          public OleDateTime getTime()

      Returns Time part of a date/time value
      Returns:
        Time part of a date/time value

    - #### getDate

          public OleDateTime getDate()

      Returns Date part of a date/time value
      Returns:
        Date part of a date/time value

    - #### _TmFromOleDate

          private static OleDateTime.TM _TmFromOleDate(double dtSrc)

    - #### asLong

          private long asLong()

    - #### compareTo

          public int compareTo(java.lang.Object o)

      Compares two OleDateTime values
      Specified by:
        `compareTo` in interface `java.lang.Comparable`
      Parameters:
        `o` - OleDateTime value to compare with
      Returns:
        equal = 0, less = -1, greater = 1

    - #### compare

          public static int compare(double d1,
                    double d2)

      Compares two double values representing OleDateTime
      Parameters:
        `d1` - First COleDateTime "double" value
        `d2` - Second COleDateTime "double" value
      Returns:
        equal = 0, less = -1, greater = 1

    - #### addDateTimeSpan

          public OleDateTime addDateTimeSpan(int days,
                                    int hours,
                                    int mins)

      Adds a day/time span to a date/time value
      Parameters:
        `days` - Number of days to add
        `hours` - Number of hours to add
        `mins` - Number of minutes to add
      Returns:
        Calculated new date/time value

    - #### substractDateTimeSpan

          public OleDateTime substractDateTimeSpan(int days,
                                          int hours,
                                          int mins)

      Subtracts a day/time span from a date/time value
      Parameters:
        `days` - Number of days to subtract
        `hours` - Number of hours to subtract
        `mins` - Number of minutes to subtract
      Returns:
        Calculated new date/time value

    - #### diffMinutes

          public static int diffMinutes(OleDateTime t1,
                        OleDateTime t2)

      Calculates the number of minutes between two date/time values
      Parameters:
        `t1` - First date/time value
        `t2` - Second date/time value
      Returns:
        (t1 - t2) in minutes

    - #### toDateTimeString

          public java.lang.String toDateTimeString()

      Returns:
        OleDateTime as a human-readable string value

    - #### toDateString

          public java.lang.String toDateString()

      Returns Date part of OleDateTime as a human-readable string value
      Returns:
        Date part of OleDateTime as a human-readable string value

    - #### toTimeString

          public java.lang.String toTimeString()

      Returns Time part of OleDateTime as a human-readable string value
      Returns:
        Time part of OleDateTime as a human-readable string value

    - #### WriteToStream

          public void WriteToStream(java.io.DataOutputStream s)
                             throws java.lang.Exception

      Writes OleDateTime value to stream
      Parameters:
        `s` - stream
      Throws:
        `java.lang.Exception`

    - #### ReadFromStream

          public void ReadFromStream(java.io.DataInputStream s)
                              throws java.lang.Exception

      Reads OleDateTime value from stream
      Parameters:
        `s` - stream
      Throws:
        `java.lang.Exception`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

Copyright © 2005-2016 Genesys Telecommunications Labs, Inc. All Rights Reserved.