@API.Public public final class OTimestamp extends Object implements Comparable<OTimestamp>, Serializable
TIMESTAMP type.| Constructor and Description |
|---|
OTimestamp(Date date)
Constructs an
OTimestamp instance from a java.util.Date using
exactly the same field values. |
OTimestamp(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
Constructs an
OTimestamp instance set to the specified fields in the
default time zone. |
OTimestamp(long millisSinceEpoch)
Constructs an
OTimestamp instance from the milliseconds value since the
Unix epoch. |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(OTimestamp o) |
boolean |
equals(Object obj) |
int |
getDayOfMonth() |
int |
getHour() |
long |
getMillis() |
int |
getMilliSecond() |
int |
getMinute() |
int |
getMonth() |
int |
getSecond() |
int |
getYear() |
int |
hashCode() |
static OTimestamp |
parse(String dateTimeStr)
Parses and return an instance of
OTimestamp from the specified string. |
Date |
toDate()
Get this timestamp as a
Date. |
String |
toLocalString()
Returns the ISO8601 format timestamp string in local time zone.
|
String |
toString() |
String |
toString(String pattern)
Return the string representation the timestamp using the specified format
pattern.
|
String |
toUTCString()
Returns the ISO8601 format timestamp string in UTC.
|
public OTimestamp(long millisSinceEpoch)
OTimestamp instance from the milliseconds value since the
Unix epoch.millisSinceEpoch - the milliseconds from 1970-01-01T00:00:00.000 UTCpublic OTimestamp(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisOfSecond)
OTimestamp instance set to the specified fields in the
default time zone.year - the yearmonthOfYear - the month of the year, from 1 to 12dayOfMonth - the day of the month, from 1 to 31hourOfDay - the hour of the day, from 0 to 23minuteOfHour - the minute of the hour, from 0 to 59secondOfMinute - the second of the minute, from 0 to 59millisOfSecond - the millisecond of the second, from 0 to 999public OTimestamp(Date date)
OTimestamp instance from a java.util.Date using
exactly the same field values.date - the Date to extract fields frompublic static OTimestamp parse(String dateTimeStr)
OTimestamp from the specified string.dateTimeStr - the string to parseParseException - if the beginning of the specified string
cannot be parsed.public int getYear()
Timestamp as an int.public int getMonth()
Timestamp as an int.public int getDayOfMonth()
Timestamp as an int.public int getHour()
Timestamp as an int.public int getMinute()
Timestamp as an int.public int getSecond()
Timestamp as an int.public int getMilliSecond()
Timestamp as an int.public long getMillis()
public Date toDate()
Date. The Date
object created has exactly the same millisecond as this timestamp.public String toUTCString()
public String toLocalString()
public String toString(String pattern)
pattern - the pattern specificationpublic int compareTo(OTimestamp o)
compareTo in interface Comparable<OTimestamp>Copyright © 2015–2019 MapR Technologies, Inc.. All rights reserved.