public class CDateTime
extends Object
implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
CDateTime.STYLE
Indicates differing string formats used in the MMAT.
|
Modifier and Type | Field and Description |
---|---|
(package private) ZonedDateTime |
dateTime |
Constructor and Description |
---|
CDateTime()
Creates a new instance corresponding to the current date/time ("now")
in the system default time zone as defined in its Locale.
|
CDateTime(String timeString)
Create a new instance corresponding to the date/time represented
by the string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
after(CDateTime other)
Compare this date/time value with another.
|
boolean |
before(CDateTime other)
Compare this date/time value with another.
|
boolean |
equals(CDateTime other)
Compare this date/time value with another.
|
String |
formatted(CDateTime.STYLE style)
Use one of the pre-defined styles to format the date string.
|
String |
formatted(String pattern)
Use any format pattern to display the string.
|
static CDateTime |
getEpoch()
Get the date time object that corresponds to the beginning of the epoch.
|
long |
getTime()
Fills the same role as the old Date.time() method, returning the number of milliseconds since the epoch.
|
ZonedDateTime |
getZonedDateTimeValue()
Get this date/time value in zoned date time form.
|
boolean |
inFuture()
Determines whether the given date/time is in the future when the method is called.
|
boolean |
inPast()
Determines whether the given date/time is in the past when the method is called.
|
void |
setZonedDateTimeValue(ZonedDateTime dateTime)
Set the date/time value from a zoned date time value.
|
String |
toString()
Convenience method for using the ZONED_TIMESTAMP style.
|
public CDateTime()
public CDateTime(String timeString) throws DateTimeException
timeString
- A date/time string recognized by one of the defined
style's formatters. If it is not recognized by any of them, an exception
is thrown.DateTimeException
public String formatted(CDateTime.STYLE style)
style
- public String formatted(String pattern)
pattern
- DateTimeFormatter
public ZonedDateTime getZonedDateTimeValue()
public void setZonedDateTimeValue(ZonedDateTime dateTime)
dateTime
- non-null date time value.public String toString()
toString
in class Object
public boolean after(CDateTime other)
other
- another date/time valuepublic boolean before(CDateTime other)
other
- another date/time valuepublic boolean equals(CDateTime other)
other
- another date/time valueZonedDateTime.equals(java.lang.Object)
public static CDateTime getEpoch()
public long getTime()
public boolean inFuture()
public boolean inPast()