Class MomentsAgoDateFormatter
java.lang.Object
com.biglybt.core.metasearch.utils.MomentsAgoDateFormatter
Improvement based on AZWEB-318.
- Since:
- 3.2.1.0 6/19/2007
- Version:
- 3.2.1.0 6/19/2007
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private static final Map
private static final Integer
private static final Integer
private static final Integer
private static final Integer
private static final Integer
private static final Integer
private static final Integer
private static final Long
private static final Long
private static final Long
private static final Long
private static final Long
private static final Long
private static final Long
private static final String
private static final Map
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
getMomentsAgoString
(Date pastDate) Returns "xago on " by comparing the given pastDate with the current time. static String
getMomentsAgoString
(Date pastDate, DateFormat format) Returns "xago on " by comparing the given pastDate with the current time. private static String
handleUnit
(Calendar then, Calendar now, Integer field) Checks to see if the unit we're comparing is less than the difference of the given "then" and "now" dates in milliseconds.
-
Field Details
-
ID_YEAR
-
ID_MONTH
-
ID_WEEK_OF_YEAR
-
ID_DAY
-
ID_HOUR_OF_DAY
-
ID_MINUTE
-
ID_SECOND
-
MS_IN_YEAR
-
MS_IN_MONTH
-
MS_IN_WEEK
-
MS_IN_DAY
-
MS_IN_HOUR
-
MS_IN_MINUTE
-
MS_IN_SECOND
-
AGO
- See Also:
-
PLURAL
- See Also:
-
CONVERSION_MAP
-
UNIT_MAP
-
-
Constructor Details
-
MomentsAgoDateFormatter
public MomentsAgoDateFormatter()
-
-
Method Details
-
getMomentsAgoString
Returns "xago on " by comparing the given pastDate with the current time. All formats are converted to GMT time. In the future the user might have their own locale, in which case we will display the time in their own locale (neat!) - Parameters:
pastDate
- A date in the pastformat
- The format for the pastDate- Returns:
- "x
ago on "
-
getMomentsAgoString
Returns "xago on " by comparing the given pastDate with the current time. - Parameters:
pastDate
- A default locale date in the past- Returns:
- "x
ago"
-
handleUnit
Checks to see if the unit we're comparing is less than the difference of the given "then" and "now" dates in milliseconds.- Parameters:
then
- The date we're evaluatingnow
- The current timefield
- The field which we're evaluating ("units")- Returns:
- null if then is 0 "units" from now, otherwise a displayable string that will notify the user how long ago then was from now.
-