public class DateFormatUtils
extends java.lang.Object
Date and time formatting utilities and constants.
Formatting is performed using the
FastDateFormat
class.
Modifier and Type | Field and Description |
---|---|
static FastDateFormat |
ISO_DATE_FORMAT
ISO8601 formatter for date without time zone.
|
static FastDateFormat |
ISO_DATE_TIME_ZONE_FORMAT
ISO8601-like formatter for date with time zone.
|
static FastDateFormat |
ISO_DATETIME_FORMAT
ISO8601 formatter for date-time without time zone.
|
static FastDateFormat |
ISO_DATETIME_TIME_ZONE_FORMAT
ISO8601 formatter for date-time with time zone.
|
static FastDateFormat |
ISO_TIME_FORMAT
ISO8601 formatter for time without time zone.
|
static FastDateFormat |
ISO_TIME_NO_T_FORMAT
ISO8601-like formatter for time without time zone.
|
static FastDateFormat |
ISO_TIME_NO_T_TIME_ZONE_FORMAT
ISO8601-like formatter for time with time zone.
|
static FastDateFormat |
ISO_TIME_TIME_ZONE_FORMAT
ISO8601 formatter for time with time zone.
|
static FastDateFormat |
SMTP_DATETIME_FORMAT
SMTP (and probably other) date headers.
|
Constructor and Description |
---|
DateFormatUtils()
DateFormatUtils instances should NOT be constructed in standard programming.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
format(java.util.Calendar calendar,
java.lang.String pattern)
Formats a calendar into a specific pattern.
|
static java.lang.String |
format(java.util.Calendar calendar,
java.lang.String pattern,
java.util.Locale locale)
Formats a calendar into a specific pattern in a locale.
|
static java.lang.String |
format(java.util.Calendar calendar,
java.lang.String pattern,
java.util.TimeZone timeZone)
Formats a calendar into a specific pattern in a time zone.
|
static java.lang.String |
format(java.util.Calendar calendar,
java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale)
Formats a calendar into a specific pattern in a time zone and locale.
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern)
Formats a date/time into a specific pattern.
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale)
Formats a date/time into a specific pattern in a locale.
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern,
java.util.TimeZone timeZone)
Formats a date/time into a specific pattern in a time zone.
|
static java.lang.String |
format(java.util.Date date,
java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale)
Formats a date/time into a specific pattern in a time zone and locale.
|
static java.lang.String |
format(long millis,
java.lang.String pattern)
Formats a date/time into a specific pattern.
|
static java.lang.String |
format(long millis,
java.lang.String pattern,
java.util.Locale locale)
Formats a date/time into a specific pattern in a locale.
|
static java.lang.String |
format(long millis,
java.lang.String pattern,
java.util.TimeZone timeZone)
Formats a date/time into a specific pattern in a time zone.
|
static java.lang.String |
format(long millis,
java.lang.String pattern,
java.util.TimeZone timeZone,
java.util.Locale locale)
Formats a date/time into a specific pattern in a time zone and locale.
|
static java.lang.String |
formatUTC(java.util.Date date,
java.lang.String pattern)
Formats a date/time into a specific pattern using the UTC time zone.
|
static java.lang.String |
formatUTC(java.util.Date date,
java.lang.String pattern,
java.util.Locale locale)
Formats a date/time into a specific pattern using the UTC time zone.
|
static java.lang.String |
formatUTC(long millis,
java.lang.String pattern)
Formats a date/time into a specific pattern using the UTC time zone.
|
static java.lang.String |
formatUTC(long millis,
java.lang.String pattern,
java.util.Locale locale)
Formats a date/time into a specific pattern using the UTC time zone.
|
public static final FastDateFormat ISO_DATETIME_FORMAT
public static final FastDateFormat ISO_DATETIME_TIME_ZONE_FORMAT
public static final FastDateFormat ISO_DATE_FORMAT
public static final FastDateFormat ISO_DATE_TIME_ZONE_FORMAT
public static final FastDateFormat ISO_TIME_FORMAT
public static final FastDateFormat ISO_TIME_TIME_ZONE_FORMAT
public static final FastDateFormat ISO_TIME_NO_T_FORMAT
public static final FastDateFormat ISO_TIME_NO_T_TIME_ZONE_FORMAT
public static final FastDateFormat SMTP_DATETIME_FORMAT
public DateFormatUtils()
DateFormatUtils instances should NOT be constructed in standard programming.
This constructor is public to permit tools that require a JavaBean instance to operate.
public static java.lang.String formatUTC(long millis, java.lang.String pattern)
Formats a date/time into a specific pattern using the UTC time zone.
millis
- the date to format expressed in millisecondspattern
- the pattern to use to format the datepublic static java.lang.String formatUTC(java.util.Date date, java.lang.String pattern)
Formats a date/time into a specific pattern using the UTC time zone.
date
- the date to formatpattern
- the pattern to use to format the datepublic static java.lang.String formatUTC(long millis, java.lang.String pattern, java.util.Locale locale)
Formats a date/time into a specific pattern using the UTC time zone.
millis
- the date to format expressed in millisecondspattern
- the pattern to use to format the datelocale
- the locale to use, may be null
public static java.lang.String formatUTC(java.util.Date date, java.lang.String pattern, java.util.Locale locale)
Formats a date/time into a specific pattern using the UTC time zone.
date
- the date to formatpattern
- the pattern to use to format the datelocale
- the locale to use, may be null
public static java.lang.String format(long millis, java.lang.String pattern)
Formats a date/time into a specific pattern.
millis
- the date to format expressed in millisecondspattern
- the pattern to use to format the datepublic static java.lang.String format(java.util.Date date, java.lang.String pattern)
Formats a date/time into a specific pattern.
date
- the date to formatpattern
- the pattern to use to format the datepublic static java.lang.String format(java.util.Calendar calendar, java.lang.String pattern)
Formats a calendar into a specific pattern.
calendar
- the calendar to formatpattern
- the pattern to use to format the calendarFastDateFormat.format(Calendar)
public static java.lang.String format(long millis, java.lang.String pattern, java.util.TimeZone timeZone)
Formats a date/time into a specific pattern in a time zone.
millis
- the time expressed in millisecondspattern
- the pattern to use to format the datetimeZone
- the time zone to use, may be null
public static java.lang.String format(java.util.Date date, java.lang.String pattern, java.util.TimeZone timeZone)
Formats a date/time into a specific pattern in a time zone.
date
- the date to formatpattern
- the pattern to use to format the datetimeZone
- the time zone to use, may be null
public static java.lang.String format(java.util.Calendar calendar, java.lang.String pattern, java.util.TimeZone timeZone)
Formats a calendar into a specific pattern in a time zone.
calendar
- the calendar to formatpattern
- the pattern to use to format the calendartimeZone
- the time zone to use, may be null
FastDateFormat.format(Calendar)
public static java.lang.String format(long millis, java.lang.String pattern, java.util.Locale locale)
Formats a date/time into a specific pattern in a locale.
millis
- the date to format expressed in millisecondspattern
- the pattern to use to format the datelocale
- the locale to use, may be null
public static java.lang.String format(java.util.Date date, java.lang.String pattern, java.util.Locale locale)
Formats a date/time into a specific pattern in a locale.
date
- the date to formatpattern
- the pattern to use to format the datelocale
- the locale to use, may be null
public static java.lang.String format(java.util.Calendar calendar, java.lang.String pattern, java.util.Locale locale)
Formats a calendar into a specific pattern in a locale.
calendar
- the calendar to formatpattern
- the pattern to use to format the calendarlocale
- the locale to use, may be null
FastDateFormat.format(Calendar)
public static java.lang.String format(long millis, java.lang.String pattern, java.util.TimeZone timeZone, java.util.Locale locale)
Formats a date/time into a specific pattern in a time zone and locale.
millis
- the date to format expressed in millisecondspattern
- the pattern to use to format the datetimeZone
- the time zone to use, may be null
locale
- the locale to use, may be null
public static java.lang.String format(java.util.Date date, java.lang.String pattern, java.util.TimeZone timeZone, java.util.Locale locale)
Formats a date/time into a specific pattern in a time zone and locale.
date
- the date to formatpattern
- the pattern to use to format the datetimeZone
- the time zone to use, may be null
locale
- the locale to use, may be null
public static java.lang.String format(java.util.Calendar calendar, java.lang.String pattern, java.util.TimeZone timeZone, java.util.Locale locale)
Formats a calendar into a specific pattern in a time zone and locale.
calendar
- the calendar to formatpattern
- the pattern to use to format the calendartimeZone
- the time zone to use, may be null
locale
- the locale to use, may be null
FastDateFormat.format(Calendar)
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"