com.scooterframework.web.util
Class D

java.lang.Object
  extended by com.scooterframework.web.util.D

public class D
extends java.lang.Object

D class has helper methods for Date and Time.


Field Summary
protected static java.lang.String COUNT_UNIT_SEPARATOR
           
protected static java.lang.String KEY_DAYS_AFTER
           
protected static java.lang.String KEY_DAYS_AGO
           
protected static java.lang.String KEY_HOURS_AFTER
           
protected static java.lang.String KEY_HOURS_AGO
           
protected static java.lang.String KEY_MINUTES_AFTER
           
protected static java.lang.String KEY_MINUTES_AGO
           
protected static java.lang.String KEY_MOMENTS_AFTER
           
protected static java.lang.String KEY_MOMENTS_AGO
           
protected static java.lang.String KEY_MONTHS_AFTER
           
protected static java.lang.String KEY_MONTHS_AGO
           
protected static java.lang.String KEY_NOW
           
protected static java.lang.String KEY_SECONDS_AFTER
           
protected static java.lang.String KEY_SECONDS_AGO
           
protected static java.lang.String KEY_WEEKS_AFTER
           
protected static java.lang.String KEY_WEEKS_AGO
           
protected static java.lang.String KEY_YEARS_AFTER
           
protected static java.lang.String KEY_YEARS_AGO
           
static long ONE_DAY
           
static long ONE_HOUR
           
static long ONE_MINUTE
           
static long ONE_MONTH
           
static long ONE_SECOND
           
static long ONE_WEEK
           
static long ONE_YEAR
           
 
Constructor Summary
D()
           
 
Method Summary
static java.lang.String message(java.util.Date d)
          Returns a human-friendly date/time message.
static java.lang.String message(java.util.Date d, java.util.Locale locale)
          Returns a human-friendly date/time message in a specific locale.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ONE_SECOND

public static final long ONE_SECOND
See Also:
Constant Field Values

ONE_MINUTE

public static final long ONE_MINUTE
See Also:
Constant Field Values

ONE_HOUR

public static final long ONE_HOUR
See Also:
Constant Field Values

ONE_DAY

public static final long ONE_DAY
See Also:
Constant Field Values

ONE_WEEK

public static final long ONE_WEEK
See Also:
Constant Field Values

ONE_MONTH

public static final long ONE_MONTH
See Also:
Constant Field Values

ONE_YEAR

public static final long ONE_YEAR
See Also:
Constant Field Values

KEY_SECONDS_AFTER

protected static final java.lang.String KEY_SECONDS_AFTER
See Also:
Constant Field Values

KEY_MINUTES_AFTER

protected static final java.lang.String KEY_MINUTES_AFTER
See Also:
Constant Field Values

KEY_HOURS_AFTER

protected static final java.lang.String KEY_HOURS_AFTER
See Also:
Constant Field Values

KEY_DAYS_AFTER

protected static final java.lang.String KEY_DAYS_AFTER
See Also:
Constant Field Values

KEY_WEEKS_AFTER

protected static final java.lang.String KEY_WEEKS_AFTER
See Also:
Constant Field Values

KEY_MONTHS_AFTER

protected static final java.lang.String KEY_MONTHS_AFTER
See Also:
Constant Field Values

KEY_YEARS_AFTER

protected static final java.lang.String KEY_YEARS_AFTER
See Also:
Constant Field Values

KEY_MOMENTS_AFTER

protected static final java.lang.String KEY_MOMENTS_AFTER
See Also:
Constant Field Values

KEY_NOW

protected static final java.lang.String KEY_NOW
See Also:
Constant Field Values

KEY_MOMENTS_AGO

protected static final java.lang.String KEY_MOMENTS_AGO
See Also:
Constant Field Values

KEY_SECONDS_AGO

protected static final java.lang.String KEY_SECONDS_AGO
See Also:
Constant Field Values

KEY_MINUTES_AGO

protected static final java.lang.String KEY_MINUTES_AGO
See Also:
Constant Field Values

KEY_HOURS_AGO

protected static final java.lang.String KEY_HOURS_AGO
See Also:
Constant Field Values

KEY_DAYS_AGO

protected static final java.lang.String KEY_DAYS_AGO
See Also:
Constant Field Values

KEY_WEEKS_AGO

protected static final java.lang.String KEY_WEEKS_AGO
See Also:
Constant Field Values

KEY_MONTHS_AGO

protected static final java.lang.String KEY_MONTHS_AGO
See Also:
Constant Field Values

KEY_YEARS_AGO

protected static final java.lang.String KEY_YEARS_AGO
See Also:
Constant Field Values

COUNT_UNIT_SEPARATOR

protected static final java.lang.String COUNT_UNIT_SEPARATOR
See Also:
Constant Field Values
Constructor Detail

D

public D()
Method Detail

message

public static java.lang.String message(java.util.Date d)
Returns a human-friendly date/time message. See messages.properties file for messages. You may override the message by providing your own messages in a messages properties file of your own locale.
 Sample outputs:
   moments from now
   right now
   5 minutes from now
   2 weeks ago
   10 years from now
 

Parameters:
d - a Date instance
Returns:
friendly date/time message

message

public static java.lang.String message(java.util.Date d,
                                       java.util.Locale locale)
Returns a human-friendly date/time message in a specific locale. See messages.properties file for messages. You may override the message by providing your own messages in a messages properties file of your own locale.
 Sample outputs:
   moments from now
   right now
   5 minutes from now
   2 weeks ago
   10 years from now
 

Parameters:
d - a Date instance
Returns:
friendly date/time message