Top Description Fields Methods
com.amazon.ion

public Interface IonTimestamp

extends IonValue
Known Direct Implementers
com.amazon.ion.impl.lite.IonTimestampLite
Imports
java.math.BigDecimal, java.util.Date

An Ion timestamp value.

Warning

This interface should not be implemented or extended by code outside of this library.

Field Summary

Inherited from com.amazon.ion.IonValue:
EMPTY_ARRAY

Method Summary

Modifier and TypeMethod and Description
public IonTimestamp
clone()

Redeclares com.amazon.ion.IonValue.clone.

Creates a copy of this value and all of its children.

public Date

Returns:

a new Date value, in UTC, or null if this.isNullValue().
dateValue
()

Gets the value of this Ion timestamp as a Java Date, representing the time in UTC.

public BigDecimal

Returns:

the number of milliseconds since 1970-01-01T00:00:00Z represented by this timestamp, or null if this.isNullValue().
getDecimalMillis
()

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00Z, including fractional milliseconds.

public Integer

Returns:

the positive or negative local-time offset, represented as minutes from UTC. If the offset is unknown, returns null.
getLocalOffset
()

Gets the local offset (in minutes) of this timestamp, or null if it's unknown (i.e., -00:00).

public long

Returns:

the number of milliseconds since 1970-01-01T00:00:00.000Z represented by this timestamp.
getMillis
()

Gets the value of this Ion timestamp as the number of milliseconds since 1970-01-01T00:00:00.000Z, truncating any fractional milliseconds.

public void
makeNull()

Sets this timestamp to Ion null.timestamp.

public void
setCurrentTime()

Sets the time portion of this timestamp to the current time, leaving the local offset portion unchanged.

public void
setCurrentTimeUtc()

Sets the time portion of this timestamp to the current time, and the local offset portion to UTC.

public void
setDecimalMillis(BigDecimal
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
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.

public void
setLocalOffset(int
is the new local offset, in minutes. Zero indicates UTC.
minutes
)

Sets the local-offset portion of this timestamp.

public void
setLocalOffset(Integer
is the new local offset, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
minutes
)

Sets the local-offset portion of this timestamp.

public void
setMillis(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
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.

public void
setMillisUtc(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
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.

public void
setTime(Date
will be copied into this element. If null then this becomes null.timestamp.
value
)

Sets the time portion of this timestamp.

public void
setValue(Timestamp
may be null to cause this to be null.timestamp.
timestamp
)

Sets the value of this timestamp.

public void
setValue(BigDecimal
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
,
Integer
the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
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.

public void
setValue(long
the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.
millis
,
Integer
the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).
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.

public Timestamp

Returns:

the value of this timestamp, or null if this.isNullValue().
timestampValue
()

Gets the value of this timestamp in a form suitable for use independent of Ion data.

Inherited from com.amazon.ion.IonValue:
acceptaddTypeAnnotationclearTypeAnnotationsequalsgetContainergetFieldIdgetFieldNamegetFieldNameSymbolgetSymbolTablegetSystemgetTypegetTypeAnnotationsgetTypeAnnotationSymbolshashCodehasTypeAnnotationisNullValueisReadOnlymakeReadOnlyremoveFromContainerremoveTypeAnnotationsetTypeAnnotationssetTypeAnnotationSymbolstopLevelValuetoPrettyStringtoStringtoStringwriteTo

Method Detail

cloneback to summary
public IonTimestamp clone() throws UnknownSymbolException

Redeclares com.amazon.ion.IonValue.clone.

Doc from com.amazon.ion.IonValue.clone.

Creates a copy of this value and all of its children. The cloned value may use the same shared symbol tables, but it will have an independent local symbol table if necessary. The cloned value will be modifiable regardless of whether this instance 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.

Exceptions
UnknownSymbolException:
if any part of this value has unknown text but known Sid for its field name, annotation or symbol.
dateValueback to summary
public Date dateValue()

Gets the value of this Ion 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.

Returns:Date

a new Date value, in UTC, or null if this.isNullValue().

getDecimalMillisback to summary
public BigDecimal getDecimalMillis()

Gets the value of this Ion 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.

Returns:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z represented by this timestamp, or null if this.isNullValue().

getLocalOffsetback to summary
public Integer getLocalOffset() throws NullValueException

Gets the local offset (in minutes) of this timestamp, or 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.

Returns:Integer

the positive or negative local-time offset, represented as minutes from UTC. If the offset is unknown, returns null.

Exceptions
NullValueException:
if this.isNullValue().
getMillisback to summary
public long getMillis() throws NullValueException

Gets the value of this Ion 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.

Returns:long

the number of milliseconds since 1970-01-01T00:00:00.000Z represented by this timestamp.

Exceptions
NullValueException:
if this.isNullValue().
makeNullback to summary
public void makeNull()

Sets this timestamp to Ion null.timestamp.

setCurrentTimeback to summary
public void setCurrentTime()

Sets the time portion of this timestamp to the current time, leaving the local offset portion unchanged.

If this.isNullValue(), then the local offset will be unknown.

setCurrentTimeUtcback to summary
public void setCurrentTimeUtc()

Sets the time portion of this timestamp to the current time, and the local offset portion to UTC.

setDecimalMillisback to summary
public 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.

If this is null.timestamp, then the local offset will be unknown.

Parameters
millis:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

Exceptions
IllegalArgumentException:
if the resulting timestamp would precede 0001-01-01T00:00:00Z.
NullPointerException:
if millis is null
setLocalOffsetback to summary
public void setLocalOffset(int minutes) throws NullValueException

Sets the local-offset portion of this timestamp. The time portion is not changed. Note that this method cannot set the unknown offset (-00:00); to do that use setLocalOffset(Integer).

Parameters
minutes:int

is the new local offset, in minutes. Zero indicates UTC.

Exceptions
NullValueException:
if this.isNullValue().
setLocalOffsetback to summary
public void setLocalOffset(Integer minutes) throws NullValueException

Sets the local-offset portion of this timestamp. The time portion is not changed.

Parameters
minutes:Integer

is the new local offset, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

Exceptions
NullValueException:
if this.isNullValue().
setMillisback to summary
public 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.

If this is null.timestamp, then the local offset will be unknown.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

Exceptions
IllegalArgumentException:
if the resulting timestamp would precede 0001-01-01T00:00:00Z.
setMillisUtcback to summary
public 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.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

setTimeback to summary
public void setTime(Date value)

Sets the time portion of this timestamp. If value is null, then this will become null.timestamp. If this is null.timestamp, then the local offset will be unknown.

Parameters
value:Date

will be copied into this element. If null then this becomes null.timestamp.

setValueback to summary
public void setValue(Timestamp timestamp)

Sets the value of this timestamp.

Parameters
timestamp:Timestamp

may be null to cause this to be null.timestamp.

setValueback to summary
public 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.

Parameters
millis:BigDecimal

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

localOffset:Integer

the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

Exceptions
IllegalArgumentException:
if the resulting timestamp would precede 0001-01-01T00:00:00Z.
NullPointerException:
if millis is null
setValueback to summary
public 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.

Parameters
millis:long

the number of milliseconds since 1970-01-01T00:00:00Z to be represented by this timestamp.

localOffset:Integer

the local offset of this timestamp, in minutes. Zero indicates UTC. null indicates the unknown offset (-00:00).

Exceptions
IllegalArgumentException:
if the resulting timestamp would precede 0001-01-01T00:00:00Z.
timestampValueback to summary
public Timestamp timestampValue()

Gets the value of this timestamp in a form suitable for use independent of Ion data.

Returns:Timestamp

the value of this timestamp, or null if this.isNullValue().