EMPTY_ARRAY
Modifier and Type | Method and Description |
---|---|
IonTimestamp |
clone()
Creates a copy of this value and all of its children.
|
Date |
dateValue()
Gets the value of this Ion
timestamp as a Java
Date , representing the time in UTC. |
BigDecimal |
getDecimalMillis()
Gets the value of this Ion
timestamp as the number of
milliseconds since 1970-01-01T00:00:00Z, including fractional
milliseconds. |
Integer |
getLocalOffset()
Gets the local offset (in minutes) of this timestamp, or
null if
it's unknown (i.e., -00:00 ). |
long |
getMillis()
Gets the value of this Ion
timestamp as the number of
milliseconds since 1970-01-01T00:00:00.000Z, truncating any fractional
milliseconds. |
void |
makeNull()
Sets this timestamp to Ion
null.timestamp . |
void |
setCurrentTime()
Sets the time portion of this timestamp to the current time, leaving the
local offset portion unchanged.
|
void |
setCurrentTimeUtc()
Sets the time portion of this timestamp to the current time, and the
local offset portion to UTC.
|
void |
setDecimalMillis(BigDecimal millis)
Sets this timestamp to represent the point in time that is
millis milliseconds after 1970-01-01T00:00:00Z, with the
same local offset part. |
void |
setLocalOffset(int minutes)
Sets the local-offset portion of this timestamp.
|
void |
setLocalOffset(Integer minutes)
Sets the local-offset portion of this timestamp.
|
void |
setMillis(long millis)
Sets this timestamp to represent the point in time that is
millis milliseconds after 1970-01-01T00:00:00Z, with the
same local offset part. |
void |
setMillisUtc(long millis)
Sets this timestamp to represent the point in time that is
millis milliseconds after 1970-01-01T00:00:00Z,
and sets the local offset to UTC. |
void |
setTime(Date value)
Sets the time portion of this timestamp.
|
void |
setValue(BigDecimal millis,
Integer localOffset)
Sets this timestamp to represent the point in time that is
millis milliseconds after 1970-01-01T00:00:00Z, with
the specified local offset of localOffset . |
void |
setValue(long millis,
Integer localOffset)
Sets this timestamp to represent the point in time that is
millis milliseconds after 1970-01-01T00:00:00Z, with
the specified local offset of localOffset . |
void |
setValue(Timestamp timestamp)
Sets the value of this
timestamp . |
Timestamp |
timestampValue()
Gets the value of this
timestamp in a form suitable for
use independent of Ion data. |
accept, addTypeAnnotation, clearTypeAnnotations, equals, getContainer, getFieldName, getFieldNameSymbol, getSymbolTable, getSystem, getType, getTypeAnnotations, getTypeAnnotationSymbols, hashCode, hasTypeAnnotation, isNullValue, isReadOnly, makeReadOnly, removeFromContainer, removeTypeAnnotation, setTypeAnnotations, setTypeAnnotationSymbols, topLevelValue, toPrettyString, toString, toString, writeTo
Timestamp timestampValue()
timestamp
in a form suitable for
use independent of Ion data.null
if this.isNullValue()
.Date dateValue()
timestamp
as a Java
Date
, representing the time in UTC. As a result, this method
will return the same result for all Ion representations of the same
instant, regardless of the local offset.
Because Date
instances are mutable, this method returns a
new instance from each call.
Date
value, in UTC,
or null
if this.isNullValue()
.long getMillis() throws NullValueException
timestamp
as the number of
milliseconds since 1970-01-01T00:00:00.000Z, truncating any fractional
milliseconds.
This method will return the same result for all Ion representations of
the same instant, regardless of the local offset.NullValueException
- if this.isNullValue()
.BigDecimal getDecimalMillis()
timestamp
as the number of
milliseconds since 1970-01-01T00:00:00Z, including fractional
milliseconds.
This method will return the same result for all Ion representations of
the same instant, regardless of the local offset.null
if this.isNullValue()
.void setValue(Timestamp timestamp)
timestamp
.timestamp
- may be null
to cause this to be
null.timestamp
.void setValue(BigDecimal millis, Integer localOffset)
millis
milliseconds after 1970-01-01T00:00:00Z, with
the specified local offset of localOffset
.millis
- the number of milliseconds since 1970-01-01T00:00:00Z to
be represented by this timestamp.localOffset
- the local offset of this timestamp, in minutes. Zero
indicates UTC. null
indicates the unknown
offset (-00:00
).IllegalArgumentException
- if the resulting timestamp would precede
0001-01-01T00:00:00Z.NullPointerException
- if millis
is null
void setValue(long millis, Integer localOffset)
millis
milliseconds after 1970-01-01T00:00:00Z, with
the specified local offset of localOffset
.millis
- the number of milliseconds since 1970-01-01T00:00:00Z to
be represented by this timestamp.localOffset
- the local offset of this timestamp, in minutes. Zero
indicates UTC. null
indicates the unknown
offset (-00:00
).IllegalArgumentException
- if the resulting timestamp would precede
0001-01-01T00:00:00Z.void setMillis(long millis)
millis
milliseconds after 1970-01-01T00:00:00Z, with the
same local offset part.
If this is null.timestamp
, then the local offset will be
unknown.
millis
- the number of milliseconds since 1970-01-01T00:00:00Z to
be represented by this timestamp.IllegalArgumentException
- if the resulting timestamp would
precede 0001-01-01T00:00:00Z.void setDecimalMillis(BigDecimal millis)
millis
milliseconds after 1970-01-01T00:00:00Z, with the
same local offset part.
If this is null.timestamp
, then the local offset will be
unknown.
millis
- the number of milliseconds since 1970-01-01T00:00:00Z to
be represented by this timestamp.IllegalArgumentException
- if the resulting timestamp would
precede 0001-01-01T00:00:00Z.NullPointerException
- if millis
is null
void setMillisUtc(long millis)
millis
milliseconds after 1970-01-01T00:00:00Z,
and sets the local offset to UTC.millis
- the number of milliseconds since 1970-01-01T00:00:00Z to
be represented by this timestamp.Integer getLocalOffset() throws NullValueException
null
if
it's unknown (i.e., -00:00
).
For example, the result for 1969-02-23T07:00+07:00
is 420,
the result for 1969-02-22T22:45:00.00-01:15
is -75, and
the result for 1969-02-23
(by Ion's definition, equivalent
to 1969-02-23T00:00-00:00
) is null
.
null
.NullValueException
- if this.isNullValue()
.void setTime(Date value)
value
is null
, then this will become
null.timestamp
.
If this is null.timestamp
, then the local offset will be
unknown.value
- will be copied into this element. If null then this
becomes null.timestamp
.void setCurrentTime()
If this.isNullValue()
, then the local offset will be
unknown.
void setCurrentTimeUtc()
void setLocalOffset(int minutes) throws NullValueException
-00:00
); to do that use setLocalOffset(Integer)
.minutes
- is the new local offset, in minutes. Zero indicates UTC.NullValueException
- if this.isNullValue()
.void setLocalOffset(Integer minutes) throws NullValueException
minutes
- is the new local offset, in minutes. Zero indicates UTC.
null
indicates the unknown offset (-00:00
).NullValueException
- if this.isNullValue()
.void makeNull()
null.timestamp
.IonTimestamp clone() throws UnknownSymbolException
IonValue
IonValue.isReadOnly()
.
The cloned value will be created in the context of the same
ValueFactory
as this instance; if you want a copy using a
different factory, then use ValueFactory.clone(IonValue)
instead.
clone
in interface IonValue
UnknownSymbolException
- if any part of this value has unknown text but known Sid for
its field name, annotation or symbol.