com.crystaldecisions.reports.common.value
Class DateTimeValue

java.lang.Object
  extended by CrystalValue
      extended by com.crystaldecisions.reports.common.value.FormulaValue
          extended by com.crystaldecisions.reports.common.value.DateTimeValue
All Implemented Interfaces:
java.lang.Comparable

public final class DateTimeValue
extends FormulaValue
implements java.lang.Comparable

Provides methods for converting native Java types to a format understood by the Crystal Reports Formula Language. All Java user defined functions must return a FormulaValue object.


Method Summary
 DateTimeValue addNumberToDateTime(double nDays)
           Adds nDays days to the current date and time.
 FormulaValue coerceToDate()
           Internal use only.
 FormulaValue coerceToDateTime()
           Internal use only.
 FormulaValue coerceToTime()
           Internal use only.
 int compareTo(java.lang.Object obj)
           Internal use only.
 int compareTo(java.lang.Object obj, java.util.Comparator stringComparator)
           Internal use only.
 boolean crEquals(DateTimeValue dateTimeValue)
           
 boolean equals(java.lang.Object obj, boolean caseInsensitive)
           Determines whether the parameter Object is a DateTimeValue object with the same class and value as this object.
static DateTimeValue From1900Format(double dateTime)
           
static DateTimeValue fromCalendar(java.util.Calendar calendar)
           Returns a DateTimeValue object that represents the specified calendar parameter.
static DateTimeValue fromDateAndTimeValues(DateValue dateValue, TimeValue timeValue)
           Returns a DateTimeValue object that represents the specified dateValue and timeValue parameters.
static DateTimeValue fromDateValue(DateValue dateValue)
           Returns a DateTimeValue object that represents the specified dateValue parameter.
static DateTimeValue fromOleDate(double OleDate)
           
 DateValue getDateValue()
           Gets a DateValue object that represents the date component of this DateTimeValue object.
 int getEncodedSize(ValueType type)
           
 int getEncodedSizeForArchive(ValueType type)
           
 java.util.Date getJavaDate()
           
static int GetMaxEncodedSize()
           
 double getOleDate()
           
 TimeValue getTimeValue()
           Gets a TimeValue object that represents the time component of this DateTimeValue object.
 ValueType getValueType()
           Gets a ValueType object that represents this DateTimeValue object.
 int hashCode(boolean caseInsensitive)
           Returns a hash code for this DateTimeValue object.
static DateTimeValue Load(java.io.DataInput in)
           
static DateTimeValue LoadFromArchive(IInputArchive ar)
           
static DateTimeValue Normalize(java.lang.Integer crDate, java.lang.Long timeInNs)
           Returns a DateTimeValue object that represents the input in normalized form.
static DateTimeValue now()
           Returns a DateTimeValue object that represents the current date and time at the point when the method is called.
 void store(ValueType type, ExtendedDataOutput out)
           
 void storeToArchive(ValueType type, IOutputArchive ar)
           
static double To1900Format(DateTimeValue dateTime)
           Returns a double that represents the time in the 1900 format system (the number of days since Jan 1, 1900).
 java.lang.String toString()
           Returns a String representation of this DateTimeValue object.
 
Methods inherited from class com.crystaldecisions.reports.common.value.FormulaValue
coerce, coerceToArray, coerceToArray, coerceToBoolean, coerceToBoolean, coerceToCurrency, coerceToCurrency, coerceToDate, coerceToDateTime, coerceToNumber, coerceToNumber, coerceToRange, coerceToRange, coerceToRangeArray, coerceToRangeArray, coerceToString, coerceToString, coerceToTime, getFormulaValueType, Load, LoadFromArchive, makeZeroValue
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

store

public void store(ValueType type,
                  ExtendedDataOutput out)
           throws java.io.IOException
Throws:
java.io.IOException

storeToArchive

public void storeToArchive(ValueType type,
                           IOutputArchive ar)
                    throws ArchiveException
Throws:
ArchiveException

Load

public static DateTimeValue Load(java.io.DataInput in)
                          throws java.io.IOException
Throws:
java.io.IOException

LoadFromArchive

public static DateTimeValue LoadFromArchive(IInputArchive ar)
                                     throws ArchiveException
Throws:
ArchiveException

getEncodedSizeForArchive

public int getEncodedSizeForArchive(ValueType type)

GetMaxEncodedSize

public static int GetMaxEncodedSize()

getEncodedSize

public int getEncodedSize(ValueType type)

Normalize

public static DateTimeValue Normalize(java.lang.Integer crDate,
                                      java.lang.Long timeInNs)

Returns a DateTimeValue object that represents the input in normalized form. If the time is greater than a day, then the time is converted into a time that is less than one day and the number of days in the date is updated accordingly.

Parameters:
crDate - the unnormalized date. Use null if the value of date should be null.
timeInNs - unnormalized time in nanoseconds. Use null if the value of time the time should be null.
Returns:
a DateTimeValue object that represents the input in normalized form

now

public static DateTimeValue now()

Returns a DateTimeValue object that represents the current date and time at the point when the method is called.

Returns:
a DateTimeValue object that represents the current date and time

fromDateAndTimeValues

public static DateTimeValue fromDateAndTimeValues(DateValue dateValue,
                                                  TimeValue timeValue)

Returns a DateTimeValue object that represents the specified dateValue and timeValue parameters.

Parameters:
dateValue - a DateValue object that specifies the date
timeValue - a TimeValue object that specifies the time
Returns:
a DateTimeValue object that represents the specified date and time, or null if both the dateValue and timeValue parameters are null

fromDateValue

public static DateTimeValue fromDateValue(DateValue dateValue)

Returns a DateTimeValue object that represents the specified dateValue parameter.

Parameters:
dateValue - a DateValue object that specifies the date
Returns:
a DateTimeValue object that represents the specified date, or null if the dateValue parameter is null

fromCalendar

public static DateTimeValue fromCalendar(java.util.Calendar calendar)

Returns a DateTimeValue object that represents the specified calendar parameter.

Parameters:
calendar - a Calendar object that specifies the calendar
Returns:
a DateTimeValue object that represents the specified calendar

fromOleDate

public static DateTimeValue fromOleDate(double OleDate)

coerceToDate

public FormulaValue coerceToDate()

Internal use only.

Overrides:
coerceToDate in class FormulaValue

coerceToTime

public FormulaValue coerceToTime()

Internal use only.

Overrides:
coerceToTime in class FormulaValue

coerceToDateTime

public FormulaValue coerceToDateTime()

Internal use only.

Overrides:
coerceToDateTime in class FormulaValue

getOleDate

public double getOleDate()

getDateValue

public DateValue getDateValue()

Gets a DateValue object that represents the date component of this DateTimeValue object.

Returns:
a DateValue object that represents the date component of this DateTimeValue object

getTimeValue

public TimeValue getTimeValue()

Gets a TimeValue object that represents the time component of this DateTimeValue object.

Returns:
a TimeValue object that represents the time component of this DateTimeValue object

getValueType

public ValueType getValueType()

Gets a ValueType object that represents this DateTimeValue object.

Returns:
ValueType.dateTime

hashCode

public int hashCode(boolean caseInsensitive)

Returns a hash code for this DateTimeValue object.

Returns:
an int that is a hash code for this DateTimeValue object

equals

public boolean equals(java.lang.Object obj,
                      boolean caseInsensitive)

Determines whether the parameter Object is a DateTimeValue object with the same class and value as this object.

Parameters:
obj - the Object to compare this DateTimeValue object to
Returns:
true if obj has the same class and value is this DateTimeValue object

compareTo

public int compareTo(java.lang.Object obj,
                     java.util.Comparator stringComparator)

Internal use only.


compareTo

public int compareTo(java.lang.Object obj)

Internal use only.

Specified by:
compareTo in interface java.lang.Comparable

addNumberToDateTime

public DateTimeValue addNumberToDateTime(double nDays)

Adds nDays days to the current date and time.
nDays can also represent fractional days (for example, 2 minutes, 4 hours, 3 days and 2 hours and 1 second) For compatibility with C++, fractional days will be truncated to the nearest second.
If nDays is negative, nDays days is subtracted from the date

Parameters:
nDays - the number of days (or fractional days) to add (or subtracts)
Returns:
a DateTimeValue object with the updated date and time

toString

public java.lang.String toString()

Returns a String representation of this DateTimeValue object. The String is of the form: "dt([date][time])", where [date] is the String representation for a DateTimeValue object and [time] is the String representation for a TimeValue object.

Returns:
a String representation of this DateTimeValue object

To1900Format

public static double To1900Format(DateTimeValue dateTime)

Returns a double that represents the time in the 1900 format system (the number of days since Jan 1, 1900).

Parameters:
dateTime - a DateTimeValue object to be represented in 1900 format system
Returns:
a double that represents the time in the 1900 format system

From1900Format

public static DateTimeValue From1900Format(double dateTime)

getJavaDate

public java.util.Date getJavaDate()

crEquals

public boolean crEquals(DateTimeValue dateTimeValue)