Modifier and Type | Field and Description |
---|---|
public static final DateFormat | DATE_HEADER_FORMAT
Format used for SMTP (and probably other) Date headers. |
private static final DateFormat | |
public static final ThreadLocal | EN_US_DATE_FORMAT_MIN
Provides a thread-local US-style date format. |
public static final ThreadLocal | EN_US_DATE_FORMAT_SEC
Provides a thread-local US-style date format. |
public static final String | ISO8601_DATE_PATTERN
ISO8601-like pattern for date. |
public static final String | ISO8601_DATETIME_PATTERN
ISO8601-like pattern for date-time. |
public static final String | ISO8601_TIME_PATTERN
ISO8601-like pattern for time. |
private static final Pattern | |
private static final ThreadLocal | |
private static final double[] | |
private static final MessageFormat | |
private static final ChoiceFormat | |
private static final String[] | |
private static final int | |
private static final int | |
private static final int | |
private static final ChoiceFormat | |
private static final String[] | |
private static final int |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
private static DateFormat | Returns: the configured format for this pattern.the pattern used for date/time formatting. pattern)return a lenient date format set to GMT time zone. |
public static String | |
public static String | |
public static String | Returns: the formatted text in minutes/seconds.the elapsed time to report in milliseconds. millis)Format an elapsed time into a pluralization correct string. |
public static String | Returns: the current date.Returns the current Date in a format suitable for a SMTP date header. |
public static int | Returns: The phase of the moon as a number between 0 and 7 with 0 meaning new moon and 4 meaning full moon.the calendar. cal)Calculate the phase of the moon for a given date. |
public static Date | Returns: a java.util.Date object as parsed by the format.string to be parsed datestr)Parses the string in a format suitable for a SMTP date header. |
public static Date | Returns: a java.util.Date object as parsed by the format.string to be parsed datestr)Parse a string as a date using the ISO8601_DATE format which is
|
public static Date | Returns: a java.util.Date object as parsed by the format.string to be parsed datestr)Parse a string as a datetime using the ISO8601_DATETIME format which is
|
public static Date | Returns: a java.util.Date object as parsed by the formats.string to be parsed datestr)Parse a string as a date using the either the ISO8601_DATETIME or ISO8601_DATE formats. |
public static Date | Returns: DateString dateStr)Parse a lenient ISO 8601, ms since epoch, or |
DATE_HEADER_FORMAT | back to summary |
---|---|
public static final DateFormat DATE_HEADER_FORMAT
Deprecated DateFormat is not thread safe, and we cannot guarantee that some other code is using the format in parallel. Deprecated since ant 1.8 Format used for SMTP (and probably other) Date headers. |
DATE_HEADER_FORMAT_INT | back to summary |
---|---|
private static final DateFormat DATE_HEADER_FORMAT_INT |
EN_US_DATE_FORMAT_MIN | back to summary |
---|---|
public static final ThreadLocal<DateFormat> EN_US_DATE_FORMAT_MIN Provides a thread-local US-style date format. Exactly as used by
|
EN_US_DATE_FORMAT_SEC | back to summary |
---|---|
public static final ThreadLocal<DateFormat> EN_US_DATE_FORMAT_SEC Provides a thread-local US-style date format. Exactly as used by
|
ISO8601_DATE_PATTERN | back to summary |
---|---|
public static final String ISO8601_DATE_PATTERN ISO8601-like pattern for date. |
ISO8601_DATETIME_PATTERN | back to summary |
---|---|
public static final String ISO8601_DATETIME_PATTERN ISO8601-like pattern for date-time. It does not support timezone.
|
ISO8601_TIME_PATTERN | back to summary |
---|---|
public static final String ISO8601_TIME_PATTERN ISO8601-like pattern for time. |
iso8601normalizer | back to summary |
---|---|
private static final Pattern iso8601normalizer |
iso8601WithTimeZone | back to summary |
---|---|
private static final ThreadLocal<DateFormat> iso8601WithTimeZone |
LIMITS | back to summary |
---|---|
private static final double[] LIMITS |
MINUTE_SECONDS | back to summary |
---|---|
private static final MessageFormat MINUTE_SECONDS |
MINUTES_FORMAT | back to summary |
---|---|
private static final ChoiceFormat MINUTES_FORMAT |
MINUTES_PART | back to summary |
---|---|
private static final String[] MINUTES_PART |
ONE_HOUR | back to summary |
---|---|
private static final int ONE_HOUR |
ONE_MINUTE | back to summary |
---|---|
private static final int ONE_MINUTE |
ONE_SECOND | back to summary |
---|---|
private static final int ONE_SECOND |
SECONDS_FORMAT | back to summary |
---|---|
private static final ChoiceFormat SECONDS_FORMAT |
SECONDS_PART | back to summary |
---|---|
private static final String[] SECONDS_PART |
TEN | back to summary |
---|---|
private static final int TEN |
DateUtils | back to summary |
---|---|
private DateUtils() private constructor |
createDateFormat | back to summary |
---|---|
private static DateFormat createDateFormat(String pattern) return a lenient date format set to GMT time zone.
|
format | back to summary |
---|---|
public static String format(long date, String pattern) Format a date/time into a specific pattern. |
format | back to summary |
---|---|
public static String format(Date date, String pattern) Format a date/time into a specific pattern. |
formatElapsedTime | back to summary |
---|---|
public static String formatElapsedTime(long millis) Format an elapsed time into a pluralization correct string. It is limited only to report elapsed time in minutes and seconds and has the following behavior.
|
getDateForHeader | back to summary |
---|---|
public static String getDateForHeader() Returns the current Date in a format suitable for a SMTP date header.
|
getPhaseOfMoon | back to summary |
---|---|
public static int getPhaseOfMoon(Calendar cal) Calculate the phase of the moon for a given date. Code heavily influenced by hacklib.c in Nethack The Algorithm: moon period = 29.53058 days ~= 30, year = 365.2422 days days moon phase advances on first day of year compared to preceding year = 365.2422 - 12 * 29.53058 ~= 11 years in Metonic cycle (time until same phases fall on the same days of the month) = 18.6 ~= 19 moon phase on first day of year (epact) ~= (11*(year%19) + 18) % 30 (18 as initial condition for 1900) current phase in days = first day phase + days elapsed in year 6 moons ~= 177 days 177 ~= 8 reported phases * 22 + 11 / 22 for rounding
|
parseDateFromHeader | back to summary |
---|---|
public static Date parseDateFromHeader(String datestr) throws ParseException Parses the string in a format suitable for a SMTP date header.
|
parseIso8601Date | back to summary |
---|---|
public static Date parseIso8601Date(String datestr) throws ParseException Parse a string as a date using the ISO8601_DATE format which is
|
parseIso8601DateTime | back to summary |
---|---|
public static Date parseIso8601DateTime(String datestr) throws ParseException Parse a string as a datetime using the ISO8601_DATETIME format which is
|
parseIso8601DateTimeOrDate | back to summary |
---|---|
public static Date parseIso8601DateTimeOrDate(String datestr) throws ParseException Parse a string as a date using the either the ISO8601_DATETIME or ISO8601_DATE formats.
|
parseLenientDateTime | back to summary |
---|---|
public static Date parseLenientDateTime(String dateStr) throws ParseException Parse a lenient ISO 8601, ms since epoch, or
|