DateTimeEntity

  • DateTimeEntity is a class that extracts and provides estimated date-time values from text.

  • It includes a nested class, DateTimeGranularity, to define the precision of the extracted timestamp.

  • Various granularity constants are available, ranging from year to second.

  • Public methods allow retrieval of the timestamp in milliseconds and its corresponding granularity.

public final class DateTimeEntity extends Entity

A date-time entity extracted from a piece of text. It provides estimated values for the date-time expressed in the text.

Nested Class Summary

@interface DateTimeEntity.DateTimeGranularity The precision of a timestamp that was extracted from text. 

Constant Summary

int GRANULARITY_DAY
int GRANULARITY_HOUR
int GRANULARITY_MINUTE
int GRANULARITY_MONTH
int GRANULARITY_SECOND
int GRANULARITY_WEEK
int GRANULARITY_YEAR

Inherited Constant Summary

Public Method Summary

int
getDateTimeGranularity()
Returns granularity (e.g.
long
getTimestampMillis()
The timestamp in milliseconds from the epoch of 1970-01-01T00:00:00Z (UTC timezone).

Inherited Method Summary

Constants

public static final int GRANULARITY_DAY

Constant Value: 3

public static final int GRANULARITY_HOUR

Constant Value: 4

public static final int GRANULARITY_MINUTE

Constant Value: 5

public static final int GRANULARITY_MONTH

Constant Value: 1

public static final int GRANULARITY_SECOND

Constant Value: 6

public static final int GRANULARITY_WEEK

Constant Value: 2

public static final int GRANULARITY_YEAR

Constant Value: 0

Public Methods

public int getDateTimeGranularity ()

Returns granularity (e.g. GRANULARITY_DAY) for the timestamp returned by getTimestampMillis().

public long getTimestampMillis ()

The timestamp in milliseconds from the epoch of 1970-01-01T00:00:00Z (UTC timezone).