public class OleDateTime
extends java.lang.Object
implements java.lang.Comparable
Modifier and Type | Class and Description |
---|---|
private static class |
OleDateTime.TM |
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 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
|
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
|
public static final int STATUS_ERROR
public static final int STATUS_VALID
public static final int STATUS_INVALID
public static final int STATUS_NULL
private double m_dt
private int m_status
private static final double OLE_DATETIME_HALFSECOND
private static final double HALF_SECOND
private static final int[] _monthDays
private static final int MIN_DATE
private static final int MAX_DATE
public OleDateTime()
public OleDateTime(double dt)
dt
- Number of days (with fraction) passed since 12/30/1899public OleDateTime(int wYear, int wMonth, int wDay, int wHour, int wMinute)
wYear
- Year from 1899 to 9999wMonth
- Month of year (1 = Jan)wDay
- Day of month (0-31)wHour
- Hour in day (0-23)wMinute
- Minute in hour (0-59)public OleDateTime(int wYear, int wMonth, int wDay)
wYear
- Year from 1899 to 9999wMonth
- Month of year (1 = Jan)wDay
- Day of month (0-31)public OleDateTime(int wHour, int wMinute)
wHour
- Hour in day (0-23)wMinute
- Minute in hour (0-59)public OleDateTime(java.util.Calendar c)
c
- Calendar value to construct frompublic static java.util.Calendar Double2GMTCalendar(double dSrc)
dSrc
- Floating-point value representing the OleDateTime valuepublic static double Calendar2Double(java.util.Calendar cSrc)
cSrc
- Calendar value to convertpublic java.util.Calendar asGMTCalendar()
public double asDouble()
public int getStatus()
public void setStatus(int status)
status
- STATUS_ERROR, STATUS_VALID, STATUS_INVALID or STATUS_NULLpublic int getYear()
public int getMonth()
public int getDay()
public int getHour()
public int getMinute()
public int getDayOfWeek()
public int getDayOfYear()
public int setDateTime(int wYear, int wMonth, int wDay, int wHour, int wMinute)
wYear
- Year from 1899 to 9999wMonth
- Month of year (1 = Jan)wDay
- Day of month (0-31)wHour
- Hour in day (0-23)wMinute
- Minute in hour (0-59)public int setTime(int wHour, int wMinute)
wHour
- Hour in day (0-23)wMinute
- Minute in hour (0-59)public OleDateTime getTime()
public OleDateTime getDate()
private static OleDateTime.TM _TmFromOleDate(double dtSrc)
private long asLong()
public int compareTo(java.lang.Object o)
compareTo
in interface java.lang.Comparable
o
- OleDateTime value to compare withpublic static int compare(double d1, double d2)
d1
- First COleDateTime "double" valued2
- Second COleDateTime "double" valuepublic OleDateTime addDateTimeSpan(int days, int hours, int mins)
days
- Number of days to addhours
- Number of hours to addmins
- Number of minutes to addpublic OleDateTime substractDateTimeSpan(int days, int hours, int mins)
days
- Number of days to subtracthours
- Number of hours to subtractmins
- Number of minutes to subtractpublic static int diffMinutes(OleDateTime t1, OleDateTime t2)
t1
- First date/time valuet2
- Second date/time valuepublic java.lang.String toDateTimeString()
public java.lang.String toDateString()
public java.lang.String toTimeString()
public void WriteToStream(java.io.DataOutputStream s) throws java.lang.Exception
s
- streamjava.lang.Exception
public void ReadFromStream(java.io.DataInputStream s) throws java.lang.Exception
s
- streamjava.lang.Exception
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
Copyright © 2005-2016 Genesys Telecommunications Labs, Inc. All Rights Reserved.