public class CDateTime
extends com.ibm.icu.util.GregorianCalendar
DateTimeDataElement
Modifier and Type | Field and Description |
---|---|
static int |
QUARTER |
AM, AM_PM, APRIL, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, HOUR, HOUR_OF_DAY, IS_LEAP_MONTH, JANUARY, JULIAN_DAY, JULY, JUNE, MARCH, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, WALLTIME_FIRST, WALLTIME_LAST, WALLTIME_NEXT_VALID, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET
Constructor and Description |
---|
CDateTime()
A zero-arg default constructor
|
CDateTime(com.ibm.icu.util.Calendar c)
A constructor that creates an instance from a given
Calendar
value |
CDateTime(java.util.Date d)
A constructor that creates an instance from a given
java.util.Date value. |
CDateTime(int year,
int month,
int date)
A constructor that creates an instance for a specified year, month and
date
|
CDateTime(int year,
int month,
int date,
int hour,
int minute)
A constructor that creates an instance for a specified year, month, date,
hour and minute
|
CDateTime(int year,
int month,
int date,
int hour,
int minute,
int second)
A constructor that creates an instance for a specified year, month, date,
hour and minute
|
CDateTime(java.util.Locale aLocale)
Deprecated.
use
CDateTime(ULocale) instead. |
CDateTime(long lTimeInMillis)
A constructor that creates an instance from a given
long
value |
CDateTime(com.ibm.icu.util.TimeZone tz)
A constructor that creates a default instance for a given timezone
|
CDateTime(com.ibm.icu.util.TimeZone tz,
java.util.Locale locale)
Deprecated.
use
CDateTime(TimeZone, ULocale) instead. |
CDateTime(com.ibm.icu.util.TimeZone tz,
com.ibm.icu.util.ULocale locale)
A constructor that creates a default instance for a given timezone and
locale
|
CDateTime(com.ibm.icu.util.ULocale locale)
A constructor that creates a default instance for a given locale
|
Modifier and Type | Method and Description |
---|---|
void |
add(int unit,
int step) |
boolean |
after(java.lang.Object when) |
CDateTime |
backward(int iUnit,
int iStep)
A convenient method used in building the ticks for a datetime scale.
|
boolean |
before(java.lang.Object when) |
void |
clearAbove(int iUnit)
Reset year units for this datetime instance above a specified unit.
|
void |
clearAbove(int iUnit,
boolean always)
Reset year units for this datetime instance above a specified unit.
|
void |
clearBelow(int iUnit)
Zeroes out all units for this datetime instance below a specified unit.
|
void |
clearBelow(int iUnit,
boolean always)
Zeroes out all units for this datetime instance below a specified unit.
|
static double |
computeDifference(CDateTime cdt1,
CDateTime cdt2,
int iUnit)
Computes the difference between two given datetime values as a fraction
for the requested field.
|
static double |
computeDifference(CDateTime cdt1,
CDateTime cdt2,
int iUnit,
boolean trimBelow)
Computes the difference between two given datetime values as a fraction
for the requested field.
|
static int |
computeUnit(CDateTime[] cdta)
Walks through all values in a datetime array and computes the least
significant unit for which a difference was noted.
|
static int |
computeUnit(DataSetIterator dsi)
Walks through all values in a dataset and computes the least significant
unit for which a difference was noted.
|
CDateTime |
forward(int iUnit,
int iStep)
A convenient method used in building the ticks for a datetime scale.
|
java.util.Date |
getDateTime() |
int |
getDay()
Returns the day of the month associated with this instance
|
static int |
getDifference(CDateTime cdt1,
CDateTime cdt2)
Returns the most significant datetime unit in which there's a difference
or 0 if there is no difference.
|
int |
getHour()
Returns the hour (military) associated with this instance
|
static int |
getMaximumDaysIn(int iYear)
Returns the number of days for a particular year
|
static int |
getMaximumDaysIn(int iMonth,
int iYear)
Returns the number of days for a particular (month,year) combination
|
int |
getMinute()
Returns the minute associated with this instance
|
int |
getMonth()
Returns the month (0-based) associated with this instance
|
static java.lang.String |
getPreferredFormat(int iUnit)
Returns a preferred format specifier for tick labels that represent axis
values that will be computed based on the difference between cdt1 and
cdt2
|
static int |
getPreferredUnit(CDateTime minDateTime,
CDateTime maxDateTime)
Returns a preferred format specifier for given data-time values will be
computed based on the difference between minDateTime and maxDateTime
|
int |
getSecond()
Returns the second associated with this instance
|
CDateTime |
getUnitStart(int iUnit)
returns a CDateTime, whose value equals to the unit start of the current
instance
|
int |
getYear()
Returns the year associated with this instance
|
static double |
inMillis(int iUnit)
A convenience method provided to return the number of milliseconds
available in a given unit
|
boolean |
isFullDateTime()
Represents if current value has both Date and Time.
|
boolean |
isTimeOnly()
The property timeOnly indicates that this instance of CDateTime only
represents a Time value, the Date value will be ignored.
|
static CDateTime |
parse(java.lang.String sDateTimeValue)
Parses a value formatted as MM-dd-yyyy HH:mm:ss and attempts to create an
instance of this object
|
void |
setTimeOnly(boolean timeOnly)
The property timeOnly indicates that this instance of CDateTime only
represents a Time value, the Date value will be ignored.
|
java.lang.String |
toString() |
getActualMaximum, getActualMinimum, getGregorianChange, getType, hashCode, isEquivalentTo, isLeapYear, roll, setGregorianChange
clear, clear, clone, compareTo, equals, fieldDifference, get, getAvailableLocales, getAvailableULocales, getDateTimeFormat, getDateTimeFormat, getDateTimePattern, getDayOfWeekType, getDisplayName, getDisplayName, getFieldCount, getFirstDayOfWeek, getGreatestMinimum, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getKeywordValuesForLocale, getLeastMaximum, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getRelatedYear, getRepeatedWallTimeOption, getSkippedWallTimeOption, getTime, getTimeInMillis, getTimeZone, getWeekData, getWeekDataForRegion, getWeekendTransition, haveDefaultCentury, isLenient, isSet, isWeekend, isWeekend, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setRelatedYear, setRepeatedWallTimeOption, setSkippedWallTimeOption, setTime, setTimeInMillis, setTimeZone, setWeekData
public static final int QUARTER
public CDateTime()
public CDateTime(java.util.Date d)
java.util.Date
value. If it's an instance of
java.sql.Date
, it's Date only data. If it's an instance of
java.sql.Time
, it's Time only data. Otherwise, it means full
date time value.d
- A previously defined Date instancepublic CDateTime(com.ibm.icu.util.Calendar c)
Calendar
valuec
- A previously defined Calendar instancepublic CDateTime(long lTimeInMillis)
long
valuelTimeInMillis
- The time defined in millisecondspublic CDateTime(int year, int month, int date)
year
- The year associated with this instancemonth
- The month index (1-12) of the year (1-based)date
- The day of the month associated with this instancepublic CDateTime(int year, int month, int date, int hour, int minute)
year
- The year associated with this instancemonth
- The month index (1-12) of the year (1-based)date
- The day of the month associated with this instancehour
- The hour (0-23) of the day (military) associated with this
instanceminute
- The minute (0-59) of the hour associated with this instancepublic CDateTime(int year, int month, int date, int hour, int minute, int second)
year
- The year associated with this instancemonth
- The month index (1-12) of the year (1-based)date
- The day of the month associated with this instancehour
- The hour (0-23) of the day (military) associated with this
instanceminute
- The minute (0-59) of the hour associated with this instancesecond
- The second (0-59) of the minute associated with this instancepublic CDateTime(java.util.Locale aLocale)
CDateTime(ULocale)
instead.locale
- The locale for which the instance is being createdpublic CDateTime(com.ibm.icu.util.ULocale locale)
locale
- The locale for which the instance is being createdpublic CDateTime(com.ibm.icu.util.TimeZone tz)
tz
- The timezone for which the instance is being createdpublic CDateTime(com.ibm.icu.util.TimeZone tz, java.util.Locale locale)
CDateTime(TimeZone, ULocale)
instead.tz
- The timezone for which the instance is being createdlocale
- The locale for which the instance is being createdpublic CDateTime(com.ibm.icu.util.TimeZone tz, com.ibm.icu.util.ULocale locale)
tz
- The timezone for which the instance is being createdlocale
- The locale for which the instance is being createdpublic CDateTime backward(int iUnit, int iStep)
iUnit
- iStep
- public CDateTime forward(int iUnit, int iStep)
iUnit
- iStep
- public final int getYear()
public final int getMonth()
public final int getDay()
public final int getHour()
public final int getMinute()
public final int getSecond()
public static final int getDifference(CDateTime cdt1, CDateTime cdt2)
public static final java.lang.String getPreferredFormat(int iUnit)
iUnit
- The unit for which a preferred pattern is being requestedpublic static final int getPreferredUnit(CDateTime minDateTime, CDateTime maxDateTime)
minDateTime
- The minimum data-time valuemaxDateTime
- The maximum data-time valuepublic static final double computeDifference(CDateTime cdt1, CDateTime cdt2, int iUnit)
cdt1
- The first datetime valuecdt2
- The second datetime valueiUnit
- The field with respect to which the difference is being
computed as a fractionpublic static final double computeDifference(CDateTime cdt1, CDateTime cdt2, int iUnit, boolean trimBelow)
cdt1
- The first datetime valuecdt2
- The second datetime valueiUnit
- The field with respect to which the difference is being
computed as a fractiontrimBelow
- Specifies if trim the unit below the given unit.public static final int computeUnit(DataSetIterator dsi)
dsi
- The dataset iterator that facilitates visiting individual
valuespublic static final int computeUnit(CDateTime[] cdta) throws ChartException
cdta
- A datetime array for which the least significant unit
difference is to be computedChartException
public static final int getMaximumDaysIn(int iMonth, int iYear)
iMonth
- The month (0-11) for which the day count is to be retrievediYear
- The year for which the day count is to be retrievedpublic static final int getMaximumDaysIn(int iYear)
iYear
- The year for which the day count is to be retrievedpublic static final double inMillis(int iUnit)
iUnit
- The unit for which the number of milliseconds are to be
computedpublic final void clearBelow(int iUnit)
iUnit
- The unit below which all values are to be zeroed outpublic final void clearBelow(int iUnit, boolean always)
iUnit
- The unit below which all values are to be zeroed outalways
- indicates if it's always trimmed no matter if it's full date
timepublic final void clearAbove(int iUnit)
iUnit
- The unit above which year values are to be resetpublic final void clearAbove(int iUnit, boolean always)
iUnit
- The unit above which year values are to be resetalways
- indicates if it's always trimmed no matter if it's full date
timepublic CDateTime getUnitStart(int iUnit)
iUnit
- public static CDateTime parse(java.lang.String sDateTimeValue)
sDateTimeValue
- The value to be parsedpublic final java.lang.String toString()
toString
in class com.ibm.icu.util.Calendar
public boolean after(java.lang.Object when)
after
in class com.ibm.icu.util.Calendar
public boolean before(java.lang.Object when)
before
in class com.ibm.icu.util.Calendar
public boolean isTimeOnly()
public boolean isFullDateTime()
public void setTimeOnly(boolean timeOnly)
timeOnly
- The bTimeOnly to set.public void add(int unit, int step)
add
in class com.ibm.icu.util.Calendar
public java.util.Date getDateTime()
Copyright © 2005-2008 Actuate Corp. All rights reserved.