Class DateTimeValue
java.lang.Object
com.aquima.interactions.foundation.types.AbstractValue
com.aquima.interactions.foundation.types.DateValue
com.aquima.interactions.foundation.types.DateTimeValue
- All Implemented Interfaces:
IConvertable
,IPrimitiveValue
,ISingleValue
,IValue
,Serializable
,Comparable<Object>
- Direct Known Subclasses:
AttributeDateTimeValue
This primitive class holds the information about a single datetime value.
- Since:
- 7.1
- Author:
- Jon van Leuven
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DateTimeValue
This member defines the UNKNOWN value for the datetime type.Fields inherited from class com.aquima.interactions.foundation.types.DateValue
ISO8601_CUSTOM_LOCAL_DATE_TIME, MILLISECONDS_PER_DAY, MILLISECONDS_PER_HOUR, MILLISECONDS_PER_MINUTE, MILLISECONDS_PER_SECOND
-
Constructor Summary
ConstructorsConstructorDescriptionDateTimeValue
(int year, int month, int day) Construct a DateTimeValue, with year months and day at midnight Month 1 is January, day 1 is the first day of the month specified. Dates are always interpreted using the (proleptic) Gregorian calendar rules.DateTimeValue
(int year, int month, int day, int hour, int minute, int second, int millis) Construct a DateTimeValue, with year months, day, hour, minute, second.DateTimeValue
(IMultilingualText displayValue, Date date) Construct a DateTimeValue based on a Date with a display text.DateTimeValue
(DateValue other) Copy constructor.DateTimeValue
(String typeName, IMultilingualText displayValue, Date date) Construct a DateTimeValue based on a date as a domain value.Construct a DateTimeValue based on a ZonedDateTime.DateTimeValue
(Date date) Construct a DateTimeValue based on a Date. -
Method Summary
Modifier and TypeMethodDescriptionstatic DateTimeValue
This method can be used to create a DateTimeValue for the current time.This method returns a deep copy of the value.forType
(String typeName, IMultilingualText displayValue) This method adds the type and display information to the value, and returns the value with this added information.This method returns the data type of the value.getHour()
static Date
parseDateTime
(Object obj) This method tries to create a Date from the provided object.Format this DateTimeValue to a String in the format 'yyyy-MM-ddTHH:mm:ss'.toString()
static DateTimeValue
Parse an object and returns its DateTimeValue.Methods inherited from class com.aquima.interactions.foundation.types.DateValue
booleanValue, compareSimple, contains, createFor, createToday, dateValue, daysBefore, doubleValue, equals, finalize, getDayOfMonth, getDayOfWeek, getLeanDateFormat, getMonthOfYear, getValue, getWeekOfYear, getYear, hashCode, hourOfDay, hoursBefore, integerValue, isUnknown, longValue, millisBefore, millisecond, minute, minutesBefore, monthsBefore, now, parseDate, second, secondsBefore, toDateTimeValue, toDateValue, toISO8601, weeksBefore, withDays, withHours, withMilliseconds, withMinutes, withMonths, withSeconds, withWeeks, withYears, workingDaysBetween, workingDaysBetween, yearsBefore
Methods inherited from class com.aquima.interactions.foundation.types.AbstractValue
compareTo, getDisplayValue, getTypeName, isRangeValue, isSingleValue, toListValue, toRangeValue, toSingleValue
-
Field Details
-
UNKNOWN
This member defines the UNKNOWN value for the datetime type.
-
-
Constructor Details
-
DateTimeValue
Copy constructor.- Parameters:
other
- DateValue to copy.
-
DateTimeValue
public DateTimeValue(int year, int month, int day, int hour, int minute, int second, int millis) Construct a DateTimeValue, with year months, day, hour, minute, second.- Month 1 is January, day 1 is the first day of the month specified.
- Dates are always interpreted using the (proleptic) Gregorian calendar rules. Before 17.0, dates before 1582-10-15 where interpreted using the Julian calendar rules
- The system default timezone is used
- Parameters:
year
- The year of the date (1 through 9999).month
- The month of the date (a value from 1 up to 12).day
- The day of the date (a value from 1 up to the number of days in m).hour
- The hour of the date (a value from 0 up 23).minute
- The minute of the date (a value from 0 up 59).second
- The second of the date (a value from 0 up 59).millis
- The millisecond of the date (a value from 0 up 999).
-
DateTimeValue
public DateTimeValue(int year, int month, int day) Construct a DateTimeValue, with year months and day at midnight- Month 1 is January, day 1 is the first day of the month specified.
- Dates are always interpreted using the (proleptic) Gregorian calendar rules. Before 17.0, dates before 1582-10-15 where interpreted using the Julian calendar rules
- The system default timezone is used
- Parameters:
year
- The year of the date (1 through 9999).month
- The month of the date (a value from 1 up to 12).day
- The day of the date (a value from 1 up to the number of days in m).
-
DateTimeValue
Construct a DateTimeValue based on a ZonedDateTime. The year of the ZonedDateTime must be in the range 1 through 9999. Note that the given ZonedDateTime will be converted to the system default timezone.- Parameters:
zdt
- The ZonedDateTime to construct this DateValue with, may be null.- Since:
- 17.0
-
DateTimeValue
Construct a DateTimeValue based on a Date. The year of the Date must be in the range 1 through 9999. The system default timezone is used- Parameters:
date
- The Date to construct this DateValue with, may be null.
-
DateTimeValue
Construct a DateTimeValue based on a Date with a display text. The year of the Date must be in the range 1 through 9999. The system default timezone is used- Parameters:
displayValue
- Text object containing the display value that should be used.date
- The Date to construct this DateValue with, may be null.
-
DateTimeValue
Construct a DateTimeValue based on a date as a domain value. The year of the Date must be in the range 1 through 9999. The system default timezone is used- Parameters:
typeName
- The name of the domain the value belongs to.displayValue
- Text object containing the display value that should be used.date
- The Date to construct this DateValue with, may be null.
-
-
Method Details
-
valueOf
Parse an object and returns its DateTimeValue.- Date/time Strings are always interpreted using the (proleptic) Gregorian calendar rules. Before 17.0, date/time Strings before 1582-10-15 where interpreted using the Julian calendar rules
- Date/time Strings are interpreted using the system default timezone
- Parameters:
obj
- The object to parse.- Returns:
- The DateTimeValue representation of the object, never null, but can be unknown.
- Throws:
ConversionException
- Is thrown when parsing fails.
-
parseDateTime
This method tries to create a Date from the provided object. If the object is a String representation of a Date, it will be parsed. It expects a String format with date and time component. If the String contains only the date without time, it cannot be parsed. UseDateValue.valueOf(Object)
instead.- Date/time Strings are always interpreted using the (proleptic) Gregorian calendar rules. Before 17.0, date/time Strings before 1582-10-15 where interpreted using the Julian calendar rules
- Date/time Strings are interpreted using the system default timezone
- Parameters:
obj
- the object to parse into a Date- Returns:
- Date parsed from the provided object
- Throws:
ConversionException
- when the String representation of the object cannot be parsed according to the applicable format.
-
createNow
This method can be used to create a DateTimeValue for the current time. The current time is included in the resulting date time value.- Returns:
- DateTimeValue for now.
-
forType
Description copied from interface:IPrimitiveValue
This method adds the type and display information to the value, and returns the value with this added information. The method will not change the state of the value the method is invoked on, but it will return a copy of the current value with the added information.- Specified by:
forType
in interfaceIPrimitiveValue
- Overrides:
forType
in classDateValue
- Parameters:
typeName
- The type of the value.displayValue
- Multilingual text containing display values.- Returns:
- The value with the added information.
-
getDataType
Description copied from interface:IValue
This method returns the data type of the value.- Specified by:
getDataType
in interfaceIValue
- Overrides:
getDataType
in classDateValue
- Returns:
- The data type of the value.
-
toString
-
stringValue
Format this DateTimeValue to a String in the format 'yyyy-MM-ddTHH:mm:ss'.- Dates are always formatted using the (proleptic) Gregorian calendar rules. Before 17.0, dates before 1582-10-15 where formatted using the Julian calendar rules.
- The system default timezone is used.
- Specified by:
stringValue
in interfaceIConvertable
- Overrides:
stringValue
in classDateValue
- Returns:
- A String representation of this DateTimeValue
-
getHour
-
getMinute
-
getSecond
-
getMillisecond
-
duplicate
Description copied from interface:IValue
This method returns a deep copy of the value.
-