@Immutable public class ModeShapeDateTime extends Object implements DateTime
Modifier | Constructor and Description |
---|---|
|
ModeShapeDateTime() |
|
ModeShapeDateTime(Calendar jdkCalendar) |
|
ModeShapeDateTime(Date jdkDate) |
|
ModeShapeDateTime(int year,
int monthOfYear,
int dayOfMonth,
int hourOfDay,
int minuteOfHour,
int secondOfMinute,
int millisecondsOfSecond) |
|
ModeShapeDateTime(long milliseconds) |
|
ModeShapeDateTime(long milliseconds,
String timeZoneId) |
|
ModeShapeDateTime(String iso8601) |
|
ModeShapeDateTime(String iso8601,
String timeZoneId) |
protected |
ModeShapeDateTime(ZonedDateTime zonedDateTime) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(DateTime that) |
boolean |
equals(Object obj) |
long |
getMilliseconds()
Get the number of milliseconds from 1970-01-01T00:00Z.
|
long |
getMillisecondsInUtc()
Get the number of milliseconds from 1970-01-01T00:00Z with this time converted to UTC.
|
int |
getMillisOfSecond()
Get the milliseconds of the second value of this instance in time.
|
String |
getString()
Get the ISO-8601 representation of this instance in time.
|
String |
getTimeZoneId()
Get the identifier of the time zone in which this instant is defined
|
int |
getTimeZoneOffsetHours()
Get the number of hours that this time zone is offset from UTC.
|
int |
hashCode() |
boolean |
isAfter(DateTime other)
Return whether this date-time is later than the supplied date-time.
|
boolean |
isBefore(DateTime other)
Return whether this date-time is earlier than the supplied date-time.
|
boolean |
isSameAs(DateTime other)
Return whether this date-time is exactly the the same as the supplied date-time.
|
DateTime |
minus(Duration duration)
Subtract the specified amount.
|
DateTime |
plus(Duration duration)
Add the specified amount of time.
|
Calendar |
toCalendar()
Get this instance represented as a standard JDK
Calendar instance, in the default locale . |
Calendar |
toCalendar(Locale locale)
|
Date |
toDate()
Get this instance represented as a standard JDK
Date instance. |
LocalDateTime |
toLocalDateTime()
Get this instance represented as a standard JDK
LocalDateTime instance, which does not have any TZ information. |
String |
toString() |
ModeShapeDateTime |
toTimeZone(String timeZoneId)
Convert this time to the time zone given by the supplied identifier.
|
ModeShapeDateTime |
toUtcTimeZone()
Convert this time to the same instant in the UTC time zone.
|
ZonedDateTime |
toZonedDateTime()
Get this instance represented as a standard JDK
ZonedDateTime instance, which preserves the TZ information. |
public ModeShapeDateTime()
public ModeShapeDateTime(String iso8601)
public ModeShapeDateTime(long milliseconds)
public ModeShapeDateTime(long milliseconds, String timeZoneId)
public ModeShapeDateTime(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisecondsOfSecond)
public ModeShapeDateTime(Date jdkDate)
public ModeShapeDateTime(Calendar jdkCalendar)
protected ModeShapeDateTime(ZonedDateTime zonedDateTime)
public int getMillisOfSecond()
DateTime
getMillisOfSecond
in interface DateTime
public long getMilliseconds()
DateTime
Date
and Calendar
classes.getMilliseconds
in interface DateTime
public long getMillisecondsInUtc()
DateTime
Date
and Calendar
classes.getMillisecondsInUtc
in interface DateTime
public String getString()
DateTime
yyyy-mm-ddTHH:MM:SS.SSSZThe fields are separated by dashes and consist of:
HH:mm
(or '0' if UTC)public int getTimeZoneOffsetHours()
DateTime
getTimeZoneOffsetHours
in interface DateTime
public String getTimeZoneId()
DateTime
getTimeZoneId
in interface DateTime
public Calendar toCalendar()
DateTime
Calendar
instance, in the default locale
.toCalendar
in interface DateTime
public Calendar toCalendar(Locale locale)
DateTime
toCalendar
in interface DateTime
locale
- the locale in which the Calendar instance is desired; may be null if the default
locale
is to be used.public ZonedDateTime toZonedDateTime()
DateTime
ZonedDateTime
instance, which preserves the TZ information.toZonedDateTime
in interface DateTime
public LocalDateTime toLocalDateTime()
DateTime
LocalDateTime
instance, which does not have any TZ information.toLocalDateTime
in interface DateTime
public int compareTo(DateTime that)
compareTo
in interface Comparable<DateTime>
compareTo
in interface DateTime
public ModeShapeDateTime toUtcTimeZone()
DateTime
toUtcTimeZone
in interface DateTime
public ModeShapeDateTime toTimeZone(String timeZoneId)
DateTime
toTimeZone
in interface DateTime
timeZoneId
- the time zone identifierpublic boolean isBefore(DateTime other)
DateTime
isBefore
in interface DateTime
other
- the date-time to compare withDateTime.compareTo(DateTime)
,
DateTime.isSameAs(DateTime)
,
DateTime.isAfter(DateTime)
public boolean isSameAs(DateTime other)
DateTime
the equals method
in that it can be arbitrarily more strict, checking, for example, not only the logical equivalence of
the other date time, but also arbitrary additional fields such as the time zone.isSameAs
in interface DateTime
other
- the date-time to compare withDateTime.compareTo(DateTime)
,
DateTime.isBefore(DateTime)
,
DateTime.isAfter(DateTime)
public boolean isAfter(DateTime other)
DateTime
isAfter
in interface DateTime
other
- the date-time to compare withDateTime.compareTo(DateTime)
,
DateTime.isBefore(DateTime)
,
DateTime.isSameAs(DateTime)
public DateTime minus(Duration duration)
DateTime
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.