@API.Public public final class OTime extends Object implements Comparable<OTime>, Serializable
TIME
type.Constructor and Description |
---|
OTime(Date date)
Constructs an
OTime instance from a java.util.Date using
exactly the same field values. |
OTime(int hourOfDay,
int minutes,
int seconds)
Constructs an
OTime instance set to the specified hour, minute and
seconds. |
OTime(int hourOfDay,
int minutes,
int seconds,
int ms)
Constructs an
OTime instance set to the specified hour, minute,
seconds and milliseconds. |
OTime(long epoh)
Constructs an
OTime instance from the milliseconds value since the
Unix epoch. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(OTime o) |
boolean |
equals(Object obj) |
static OTime |
fromMillisOfDay(int millisOfDay)
Return an
OTime instance from the specified milliseconds since
midnight. |
int |
getHour() |
int |
getMilliSecond() |
int |
getMinute() |
int |
getSecond() |
int |
hashCode() |
static OTime |
parse(String timeStr)
Parses and return an instance of
OTime from the specified string. |
Date |
toDate()
Get this TIME as a
Date in the default timezone. |
String |
toFullTimeStr()
Returns a string representation of this TIME in "HH:mm.ss.SSS" format.
|
String |
toShortTimeStr() |
String |
toString() |
String |
toString(String pattern)
Returns a string representation of this TIME using the specified format pattern.
|
int |
toTimeInMillis() |
String |
toTimeStr()
Returns a string representation of this TIME in "HH:mm.ss[.SSS]" format.
|
public OTime(long epoh)
OTime
instance from the milliseconds value since the
Unix epoch. The TIME value is set to the corresponding time in the default
time zone.epoh
- the milliseconds from 1970-01-01T00:00:00.000 UTCpublic OTime(int hourOfDay, int minutes, int seconds)
OTime
instance set to the specified hour, minute and
seconds.hourOfDay
- the hour of the day, from 0 to 23minutes
- the minute of the hour, from 0 to 59seconds
- the second of the minute, from 0 to 59public OTime(int hourOfDay, int minutes, int seconds, int ms)
OTime
instance set to the specified hour, minute,
seconds and milliseconds.hourOfDay
- the hour of the day, from 0 to 23minutes
- the minute of the hour, from 0 to 59seconds
- the second of the minute, from 0 to 59ms
- the millisecond of the second, from 0 to 999public OTime(Date date)
OTime
instance from a java.util.Date
using
exactly the same field values. The TIME value is set to the corresponding
time in the default time zone.date
- the Date to extract fields frompublic static OTime parse(String timeStr)
OTime
from the specified string.timeStr
- the string to parseParseException
- if the beginning of the specified string
cannot be parsed.public static OTime fromMillisOfDay(int millisOfDay)
OTime
instance from the specified milliseconds since
midnight.millisOfDay
- the number of milliseconds since midnightpublic int getHour()
OTime
as an int
.public int getMinute()
OTime
as an int
.public int getSecond()
OTime
as an int
.public int getMilliSecond()
OTime
as an int
.public Date toDate()
Date
in the default timezone.
The year, month and date fields of the Date
object is set to Unix
epoch date (1970-01-01).public int toTimeInMillis()
public String toShortTimeStr()
public String toFullTimeStr()
public String toTimeStr()
public String toString(String pattern)
pattern
- the pattern specificationpublic int compareTo(OTime o)
compareTo
in interface Comparable<OTime>
Copyright © 2015–2019 MapR Technologies, Inc.. All rights reserved.