Package oracle.nosql.driver.values
Class TimestampValue
java.lang.Object
oracle.nosql.driver.values.FieldValue
oracle.nosql.driver.values.TimestampValue
- All Implemented Interfaces:
- Comparable<FieldValue>
A 
FieldValue instance representing a timestamp value. TimestampValue
 represents an instant in time in UTC. TimestampValue always stores its state
 in UTC. Instances can be created from long values which represent the number
 of milliseconds since the Epoch, 1970-01-01T00:00:00. They can also be
 created from string values in a valid ISO 8601 format. String formats without
 an explicit time zone are interpreted as UTC time.
 TimestampValue is directly correlated to the database type of the same name and should be used during value construction for fields of that datatype.
- 
Nested Class SummaryNested classes/interfaces inherited from class oracle.nosql.driver.values.FieldValueFieldValue.Type
- 
Constructor SummaryConstructorsConstructorDescriptionTimestampValue(long millisecond) Creates a new instance from milliseconds since the Epoch.TimestampValue(String value) Creates a new instance using an ISO 8601 formatted string.TimestampValue(String value, String pattern, boolean useUTC) Creates a TimestampValue instance from a String with specified pattern.TimestampValue(Timestamp value) Creates a new instance from a JavaTimestamp
- 
Method SummaryModifier and TypeMethodDescriptionintcompareTo(FieldValue other) booleanlonggetLong()Returns the long value of this object as the number of millisecond since the Epoch, 1970-01-01T00:00:00.Returns a BigDecimal value for this object based on its long value.Returns the string value of this object, it is in the ISO 8601 format "uuuu-MM-dd'T'HH:mm:ss[.f..f]" and the time zone is UTC.getType()Returns the type of the objectgetValue()Returns the JavaTimestampvalue of this objectinthashCode()toJson(JsonOptions options) Returns the JSON value of the instance.Methods inherited from class oracle.nosql.driver.values.FieldValueasArray, asBinary, asBoolean, asDouble, asInteger, asJsonNull, asLong, asMap, asNull, asNumber, asString, asTimestamp, castAsDouble, createFromJson, createFromJson, createFromJson, getBinary, getBoolean, getDouble, getInt, getSerializedSize, getTimestamp, isAnyNull, isArray, isAtomic, isBinary, isBoolean, isDouble, isInteger, isJsonNull, isLong, isMap, isNull, isNumber, isNumeric, isString, isTimestamp, toJson, toString
- 
Constructor Details- 
TimestampValuepublic TimestampValue(long millisecond) Creates a new instance from milliseconds since the Epoch.- Parameters:
- millisecond- the number of milliseconds since the Epoch, "1970-01-01T00:00:00".
 
- 
TimestampValueCreates a new instance using an ISO 8601 formatted string. If timezone is not specified it is interpreted as UTC.- Parameters:
- value- the string of a Timestamp in ISO 8601 format "uuuu-MM-dd['T'HH:mm:ss[.f..f]]".
 
- 
TimestampValueCreates a TimestampValue instance from a String with specified pattern.- Parameters:
- value- a timestamp string in the format of the specified- patternor the default pattern, "uuuu-MM-dd['T'HH:mm:ss[.f..f]]", which is used if- patternis null.
- pattern- the pattern for the timestampString. If null, then default pattern "uuuu-MM-dd['T'HH:mm:ss[.f..f]]" is used to parse the string. The symbols that can be used to specify a pattern are described in- DateTimeFormatter.
- useUTC- if true the UTC time zone is used as default zone when parsing the string, otherwise the local time zone is used. If the timestampString has zone information, then that zone will be used.
- Throws:
- IllegalArgumentException- if the string cannot be parsed with the the given pattern correctly.
 
- 
TimestampValueCreates a new instance from a JavaTimestamp- Parameters:
- value- the Timestamp value
 
 
- 
- 
Method Details- 
getTypeDescription copied from class:FieldValueReturns the type of the object- Specified by:
- getTypein class- FieldValue
- Returns:
- the type
 
- 
getValueReturns the JavaTimestampvalue of this object- Returns:
- the Timestamp value
 
- 
getLongpublic long getLong()Returns the long value of this object as the number of millisecond since the Epoch, 1970-01-01T00:00:00.- Overrides:
- getLongin class- FieldValue
- Returns:
- the long value
 
- 
getNumberReturns a BigDecimal value for this object based on its long value.- Overrides:
- getNumberin class- FieldValue
- Returns:
- the BigDecimal value
 
- 
getStringReturns the string value of this object, it is in the ISO 8601 format "uuuu-MM-dd'T'HH:mm:ss[.f..f]" and the time zone is UTC.- Overrides:
- getStringin class- FieldValue
- Returns:
- the string value
 
- 
compareTo
- 
toJsonReturns the JSON value of the instance. IfJsonOptions.getTimestampAsLong()is true it is returned as a simple long value; otherwise it is returned as a quoted string using the ISO 8601 format.- Overrides:
- toJsonin class- FieldValue
- Parameters:
- options- a JsonOptions instance to indicate non-default values, may be null.
- Returns:
- the string value.
 
- 
equals
- 
hashCodepublic int hashCode()
 
-