@Immutable @ThreadSafe public final class Timestamp extends Object implements Comparable<Timestamp>
Timestamp is required for historical operations in Concourse.
This class provides interoperability with Joda DateTime objects with
the fromJoda(DateTime) and getJoda() methods.| Modifier and Type | Field and Description |
|---|---|
static DateTimeFormatter |
DEFAULT_DATE_ONLY_FORMATTER
The default formatter that is used to display
date
only timestamps. |
static DateTimeFormatter |
DEFAULT_FORMATTER
The default formatter that is used to display objects of this class.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Timestamp other) |
static Timestamp |
epoch()
Return a
Timestamp that corresponds to the system
epoch timestamp with microsecond precision. |
boolean |
equals(Object obj) |
static Timestamp |
fromInstant(Instant instant)
Return a
Timestamp that corresponds to the specified
instant. |
static Timestamp |
fromJoda(DateTime joda)
Return the
Timestamp that corresponds to the provided joda
DateTime object. |
static Timestamp |
fromMicros(long microseconds)
Return a
Timestamp that corresponds to the provided Unix
timestamp with microsecond precision. |
static Timestamp |
fromString(String description)
|
Instant |
getInstant()
|
DateTime |
getJoda()
Return the Joda
DateTime object that corresponds to this
Timestamp. |
long |
getMicros()
Return the number of microseconds since the Unix epoch that is
represented by this Timestamp.
|
int |
hashCode() |
boolean |
isDateOnly()
Return
true of this Timestamp does not have relevant
temporal componet. |
static Timestamp |
now()
Return a
Timestamp set the current system microsecond time using
ISOChronology in the default time zone. |
static Timestamp |
now(Chronology chronology)
Return a
Timestamp set to the current system microsecond time
using the specified chronology. |
static Timestamp |
now(DateTimeZone zone)
Return a
Timestamp set to the current system microsecond time
using ISOChronology in the specified time zone. |
static Timestamp |
parse(String str,
DateTimeFormatter formatter)
Parses a
Timestamp from the specified string using a formatter. |
static Timestamp |
parse(String str,
String format)
Parse a
Timestamp from the specified string that adheres to the
provided format. |
String |
toString() |
public static final DateTimeFormatter DEFAULT_DATE_ONLY_FORMATTER
date
only timestamps.public static final DateTimeFormatter DEFAULT_FORMATTER
public static Timestamp epoch()
Timestamp that corresponds to the system
epoch timestamp with microsecond precision.public static Timestamp fromInstant(Instant instant)
Timestamp that corresponds to the specified
instant.instant - an instanceTimestamppublic static Timestamp fromJoda(DateTime joda)
Timestamp that corresponds to the provided joda
DateTime object.joda - a DateTime objectjodapublic static Timestamp fromMicros(long microseconds)
Timestamp that corresponds to the provided Unix
timestamp with microsecond precision.microseconds - the number of microseconds since the Unix epochmicrosecondspublic static Timestamp fromString(String description)
description and return a Timestamp that can be
passed to driver API methods.
Timestamp description are parsed by Concourse Server, so this method only
returns a wrapper that is meant to be passed over the wire. Timestamps
returned from this method are non-operable and will throw
exceptions if you call methods that would return a precise instant (i.e.
getJoda() or getMicros()).
description - a relative or absolute natural language description of
an instant.Timestamp that wraps the descriptionpublic static Timestamp now()
Timestamp set the current system microsecond time using
ISOChronology in the default time zone.public static Timestamp now(Chronology chronology)
Timestamp set to the current system microsecond time
using the specified chronology.chronology - the chronology, not nullpublic static Timestamp now(DateTimeZone zone)
Timestamp set to the current system microsecond time
using ISOChronology in the specified time zone.zone - the time zone, not nullpublic static Timestamp parse(String str, DateTimeFormatter formatter)
Timestamp from the specified string using a formatter.str - the string to parse, not nullformatter - the formatter to use, not nullpublic static Timestamp parse(String str, String format)
Timestamp from the specified string that adheres to the
provided format.str - the string to parse, not nullformat - the format of the string; see
http://www.joda.org/joda-time/apidocs/org/joda/time/format/DateTimeFormat.html
for detailspublic int compareTo(Timestamp other)
compareTo in interface Comparable<Timestamp>public DateTime getJoda()
DateTime object that corresponds to this
Timestamp.public long getMicros()
public boolean isDateOnly()
true of this Timestamp does not have relevant
temporal componet.true if this Timestamp represents a date