|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectwt.util.WTStandardDateFormat
public class WTStandardDateFormat
WTStandardDateFormat
This class provides methods to create display strings
from Date
objects. The methods may take as arguments, not only a Date,
but also various combinations of format type, format string, Locale and
TimeZone.
There are currently two standard formats defined: "long" and "short". "long" is the default format for methods which do not take a format argument. The format strings are in wt.util.utilResource.rbInfo.
Locale and TimeZone values default to those provided by WTContext methods.
Examples:
WTStandardDateFormat.format(myDate)WTStandardDateFormat.format(myDate, WTStandardDateFormat.SHORT_STANDARD_DATE_FORMAT)
Date,
SimpleDateFormat| Field Summary | |
|---|---|
static int |
EXPLORER_STANDARD_DATE_FORMAT
Format for the default locale is 'M/dd/yy h:mm a'. |
static int |
EXPLORER_STANDARD_DATE_ONLY_FORMAT
Format for the default locale is 'M/dd/yy'. |
static int |
EXPLORER_STANDARD_TIME_ONLY_FORMAT
Format for the default locale is 'h:mm a'. |
static int |
LONG_STANDARD_DATE_FORMAT
Format for the default locale is 'yyyy-MM-dd HH:mm:ss z'. |
static int |
LONG_STANDARD_DATE_FORMAT_MINUS_TIME
Format for the default locale is 'yyyy-MM-dd'. |
static int |
LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
Format for the default locale is 'yyyy-MM-dd HH:mm:ss'. |
static int |
SHORT_STANDARD_DATE_FORMAT
Format for the default locale is 'dd MMM yy HH:mm'. |
static int |
WF_STANDARD_DATE_ONLY_FORMAT
Format for the default locale is 'MM/dd/yyyy'. |
| Constructor Summary | |
|---|---|
WTStandardDateFormat()
No-arg constructor. |
|
| Method Summary | |
|---|---|
static String |
format(Date date)
Formats a Date into a date/time string. |
static String |
format(Date date,
int formatType)
Formats a Date into a date/time string. |
static String |
format(Date date,
int formatType,
Locale locale)
Formats a Date into a date/time string. |
static String |
format(Date date,
int formatType,
Locale locale,
TimeZone timeZone)
Formats a Date into a date/time string. |
static String |
format(Date date,
Locale locale)
Formats a Date into a date/time string. |
static String |
format(Date date,
String formatString)
Formats a Date into a date/time string. |
static String |
format(Date date,
String formatString,
Locale locale,
TimeZone timeZone)
Formats a Date into a date/time string. |
static int |
formatTypeFromString(String formatTypeString)
Converts the name of the format type to the constant that it represents. |
static Date |
parse(String date)
Parses text from a string in the format LONG_STANDARD_DATE_FORMAT to produce a Date. |
static Date |
parse(String date,
int formatType)
Parses text from a string to produce a Date. |
static Date |
parse(String date,
int formatType,
Locale locale,
TimeZone timeZone)
Parses text from a string to produce a Date. |
static Date |
parse(String date,
Locale locale)
Parses text from a string in the format LONG_STANDARD_DATE_FORMAT to produce a Date. |
static Date |
parse(String date,
String formatString)
Parses text from a string to produce a Date. |
static Date |
parse(String date,
String formatString,
Locale locale,
TimeZone timeZone)
Parses text from a string to produce a Date. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int LONG_STANDARD_DATE_FORMAT
public static final int SHORT_STANDARD_DATE_FORMAT
public static final int EXPLORER_STANDARD_DATE_FORMAT
public static final int EXPLORER_STANDARD_DATE_ONLY_FORMAT
public static final int EXPLORER_STANDARD_TIME_ONLY_FORMAT
public static final int WF_STANDARD_DATE_ONLY_FORMAT
public static final int LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
public static final int LONG_STANDARD_DATE_FORMAT_MINUS_TIME
| Constructor Detail |
|---|
public WTStandardDateFormat()
| Method Detail |
|---|
public static int formatTypeFromString(String formatTypeString)
formatTypeString - The name of the format type. Valid values are:
LONG_STANDARD_DATE_FORMAT
SHORT_STANDARD_DATE_FORMAT
WF_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_DATE_FORMAT
EXPLORER_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_TIME_ONLY_FORMAT
LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
LONG_STANDARD_DATE_FORMAT_MINUS_TIME
public static String format(Date date,
String formatString,
Locale locale,
TimeZone timeZone)
date - The date to be formatted into a String.formatString - The format string (see java.text.SimpleDateFormat).locale - The locale.timeZone - The given new time zone.
- Returns:
- The formatted date-time string.
Supported API: true
Extendable: false
public static String format(Date date,
int formatType,
Locale locale,
TimeZone timeZone)
date - The date to be formatted into a String.formatType - The format. Valid values are:
LONG_STANDARD_DATE_FORMAT
SHORT_STANDARD_DATE_FORMAT
WF_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_DATE_FORMAT
EXPLORER_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_TIME_ONLY_FORMAT
LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
LONG_STANDARD_DATE_FORMAT_MINUS_TIME
locale - The locale whose date format symbols should be used.timeZone - The given new time zone.
- Returns:
- The formatted date-time string.
Supported API: true
Extendable: false
public static String format(Date date,
String formatString)
date - The date to be formatted into a String.formatString - The format string (see java.text.SimpleDateFormat).
- Returns:
- The formatted date-time string.
Supported API: true
Extendable: false
public static String format(Date date,
int formatType,
Locale locale)
date - The date to be formatted into a String.formatType - The format. Valid values are:
LONG_STANDARD_DATE_FORMAT
SHORT_STANDARD_DATE_FORMAT
WF_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_DATE_FORMAT
EXPLORER_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_TIME_ONLY_FORMAT
LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
LONG_STANDARD_DATE_FORMAT_MINUS_TIME
locale - The locale whose date format symbols should be used.
- Returns:
- The formatted date-time string.
Supported API: true
Extendable: false
public static String format(Date date,
int formatType)
date - The date to be formatted into a String.formatType - The format. Valid values are:
- Returns:
- The formatted date-time string.
Supported API: true
Extendable: false
public static String format(Date date,
Locale locale)
date - The date to be formatted into a String.locale - The locale whose date format symbols should be used.
- Returns:
- The formatted date-time string in
LONG_STANDARD_DATE_FORMAT format.
Supported API: true
Extendable: false public static String format(Date date)
date - The date to be formatted into a String.
- Returns:
- The formatted date-time string in
LONG_STANDARD_DATE_FORMAT format.
Supported API: true
Extendable: false
public static Date parse(String date,
String formatString,
Locale locale,
TimeZone timeZone)
throws ParseException
date - The string to parse.formatString - The format string (see java.text.SimpleDateFormat).locale - The locale.timeZone - The time zone to use in parsing.
ParseException -
public static Date parse(String date,
int formatType,
Locale locale,
TimeZone timeZone)
throws ParseException
date - The string to parse.formatType - The format. Valid values are:
LONG_STANDARD_DATE_FORMAT
SHORT_STANDARD_DATE_FORMAT
WF_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_DATE_FORMAT
EXPLORER_STANDARD_DATE_ONLY_FORMAT
EXPLORER_STANDARD_TIME_ONLY_FORMAT
LONG_STANDARD_DATE_FORMAT_MINUS_TIMEZONE
LONG_STANDARD_DATE_FORMAT_MINUS_TIME
locale - The locale.timeZone - The time zone to use in parsing.
ParseException -
public static Date parse(String date,
String formatString)
throws ParseException
date - The string to parse.formatString - The format string (see java.text.SimpleDateFormat).
ParseException -
public static Date parse(String date,
int formatType)
throws ParseException
date - The string to parse.formatType - The format. Valid values are:
ParseException -
public static Date parse(String date,
Locale locale)
throws ParseException
LONG_STANDARD_DATE_FORMAT to produce a Date.
date - The string to parse.locale - The locale.
ParseException -
public static Date parse(String date)
throws ParseException
LONG_STANDARD_DATE_FORMAT to produce a Date.
date - The string to parse.
ParseException -
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||