DateFormat is an abstract class for date/time formatting.
Type | Field | Summary |
---|---|---|
static int | AM_PM_FIELD | Useful constant for AM_PM field alignment. |
static int | DATE_FIELD | Useful constant for DATE field alignment. |
static int | DAY_OF_WEEK_FIELD | Useful constant for DAY_OF_WEEK field alignment. |
static int | DAY_OF_WEEK_IN_MONTH_FIELD | Useful constant for DAY_OF_WEEK_IN_MONTH field alignment. |
static int | DAY_OF_YEAR_FIELD | Useful constant for DAY_OF_YEAR field alignment. |
static int | ERA_FIELD | Useful constant for ERA field alignment. |
static int | HOUR_OF_DAY0_FIELD | Useful constant for zero-based HOUR_OF_DAY field alignment. |
static int | HOUR_OF_DAY1_FIELD | Useful constant for one-based HOUR_OF_DAY field alignment. |
static int | HOUR0_FIELD | Useful constant for zero-based HOUR field alignment. |
static int | HOUR1_FIELD | Useful constant for one-based HOUR field alignment. |
static int | MILLISECOND_FIELD | Useful constant for MILLISECOND field alignment. |
static int | MINUTE_FIELD | Useful constant for MINUTE field alignment. |
static int | MONTH_FIELD | Useful constant for MONTH field alignment. |
static int | SECOND_FIELD | Useful constant for SECOND field alignment. |
static int | TIMEZONE_FIELD | Useful constant for TIMEZONE field alignment. |
static int | WEEK_OF_MONTH_FIELD | Useful constant for WEEK_OF_MONTH field alignment. |
static int | WEEK_OF_YEAR_FIELD | Useful constant for WEEK_OF_YEAR field alignment. |
static int | YEAR_FIELD | Useful constant for YEAR field alignment. |
Type | Field | Summary |
---|---|---|
static int | DEFAULT | Constant for default style pattern. |
static int | FULL | Constant for full style pattern. |
static int | LONG | Constant for long style pattern. |
static int | MEDIUM | Constant for medium style pattern. |
static int | SHORT | Constant for short style pattern. |
Format a date
Return | Method | Summary |
---|---|---|
String | format(Date date) | Formats a Date into a date/time string. |
StringBuffer | format(Object obj, StringBuffer toAppendTo, FieldPosition fieldPosition) | Overrides Format. |
Create new DateFormat instance
Return | Method | Summary |
---|---|---|
Calendar | getCalendar() | Gets the calendar associated with this date/time formatter. |
static DateFormat | getDateInstance() | Gets the date formatter with the default formatting style for the default locale. |
static DateFormat | getDateInstance(int style) | Gets the date formatter with the given formatting style for the default locale. |
static DateFormat | getDateInstance(int style, Locale aLocale) | Gets the date formatter with the given formatting style for the given locale. |
static DateFormat | getDateTimeInstance() | Gets the date/time formatter with the default formatting style for the default locale. |
static DateFormat | getDateTimeInstance(int dateStyle, int timeStyle) | Gets the date/time formatter with the given date and time formatting styles for the default locale. |
static DateFormat | getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) | Gets the date/time formatter with the given formatting styles for the given locale. |
static DateFormat | getInstance() | Get a default date/time formatter that uses the SHORT style for both the date and the time. |
NumberFormat | getNumberFormat() | Gets the number formatter which this date/time formatter uses to format and parse a time. |
static DateFormat | getTimeInstance() | Gets the time formatter with the default formatting style for the default locale. |
static DateFormat | getTimeInstance(int style) | Gets the time formatter with the given formatting style for the default locale. |
static DateFormat | getTimeInstance(int style, Locale aLocale) | Gets the time formatter with the given formatting style for the given locale. |
TimeZone | getTimeZone() | Gets the time zone. |
Get all locales
Return | Method | Summary |
---|---|---|
static Locale[] | getAvailableLocales() | Returns an array of all locales for which the get*Instance methods of this class can return localized instances. |
Is date/time parsed lenient
Return | Method | Summary |
---|---|---|
boolean | isLenient() | Tell whether date/time parsing is to be lenient. |
Parse string to get Date
Return | Method | Summary |
---|---|---|
Date | parse(String source) | Parses text from the beginning of the given string to produce a date. |
Object | parseObject(String source, ParsePosition pos) | Parses text from a string to produce a Date. |
Change the date formatter
Return | Method | Summary |
---|---|---|
void | setCalendar(Calendar newCalendar) | Set the calendar to be used by this date format. |
void | setLenient(boolean lenient) | Specify whether or not date/time parsing is to be lenient. |
void | setNumberFormat(NumberFormat newNumberFormat) | Allows you to set the number formatter. |
void | setTimeZone(TimeZone zone) | Sets the time zone for the calendar of this DateFormat object. |
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |