public class PrecisionDate extends Object implements PreciseDate
| Constructor and Description |
|---|
PrecisionDate()
Create a Date with a Prescision
The default constructor creates dates with seconds precision, ie:yyyyMMddHHmmssZ for other precise date use Precision(Precision p) or Precision(Precision p, long timeInMilliseconds) |
PrecisionDate(long timeInMilliseconds)
Constructed with a default precision of seconds
|
PrecisionDate(Precision timePrecision)
Constructed with a default precision of seconds
|
PrecisionDate(Precision timePrecision,
org.joda.time.DateTime date)
* Constructed a date with the specified precision equivalent to this(timePrecision,
date.getTime())
|
PrecisionDate(Precision timePrecision,
long timeInMilliseconds)
Constructed a date with the specified precision
|
| Modifier and Type | Method and Description |
|---|---|
org.joda.time.DateTime |
getDateTime() |
Precision |
getPrecision() |
static PreciseDate |
today()
convenience method to return the current date with DAY precision
|
String |
toNarrativeForm()
Return a string representation using the narrative form of formatter specified
in the Precision
|
String |
toString()
A String representation using only the required precision in HL7 ISO 8601 format
for example, a PrecisionDate with a Precsion.Day accuracy will print yyyyMMdd while a
PrecisionDate with a Precsion.Millisecond with a millisecond accuracy will print
yyyyMMddHHmmss.SSSZ
|
public PrecisionDate()
public PrecisionDate(long timeInMilliseconds)
timeInMilliseconds - the milliseconds since January 1, 1970, 00:00:00 GMT.System.currentTimeMillis()public PrecisionDate(Precision timePrecision, long timeInMilliseconds)
timeInMilliseconds - the milliseconds since January 1, 1970, 00:00:00 GMT.timePrecision - the amount of time to use. eg: Precision.day indicating that hours,
minutes and seconds are to be ignoredSystem.currentTimeMillis()public PrecisionDate(Precision timePrecision, org.joda.time.DateTime date)
timePrecision - the amount of time to use. eg: Precision.day indicating that hours,
minutes and seconds are to be ignoredSystem.currentTimeMillis()public PrecisionDate(Precision timePrecision)
System.currentTimeMillis()public static PreciseDate today()
public Precision getPrecision()
getPrecision in interface PreciseDatepublic String toString()
public org.joda.time.DateTime getDateTime()
getDateTime in interface PreciseDatepublic String toNarrativeForm()
PreciseDatetoNarrativeForm in interface PreciseDateCopyright © 2020. All rights reserved.