Constants from DateFormat

static int AM_PM_FIELD
AM_PM field alignment.
static int DATE_FIELD
DATE field alignment.
static int DAY_OF_WEEK_FIELD
DAY_OF_WEEK field alignment.
static int DAY_OF_WEEK_IN_MONTH_FIELD
DAY_OF_WEEK_IN_MONTH field alignment.
static int DAY_OF_YEAR_FIELD
DAY_OF_YEAR field alignment.
static int ERA_FIELD
ERA field alignment.
static int HOUR_OF_DAY0_FIELD
zero-based HOUR_OF_DAY field alignment.
static int HOUR_OF_DAY1_FIELD
one-based HOUR_OF_DAY field alignment.
static int HOUR0_FIELD
zero-based HOUR field alignment.
static int HOUR1_FIELD
one-based HOUR field alignment.
static int MILLISECOND_FIELD
MILLISECOND field alignment.
static int MINUTE_FIELD
MINUTE field alignment.
static int MONTH_FIELD
MONTH field alignment.
static int SECOND_FIELD
SECOND field alignment.
static int TIMEZONE_FIELD
TIMEZONE field alignment.
static int WEEK_OF_MONTH_FIELD
WEEK_OF_MONTH field alignment.
static int WEEK_OF_YEAR_FIELD
WEEK_OF_YEAR field alignment.
static int YEAR_FIELD
YEAR field alignment.
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.

import java.text.DateFormat;
import java.util.Date;
import java.util.Locale;

public class Main{

  public static void main(String args[]) {
    Date date = new Date();
    DateFormat df;

    df = DateFormat.getDateInstance(DateFormat.SHORT, Locale.JAPAN);
    System.out.println("Japan:" + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.KOREA);
    System.out.println("Korea:" + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.LONG, Locale.UK);
    System.out.println("United Kingdom:" + df.format(date));

    df = DateFormat.getDateInstance(DateFormat.FULL, Locale.US);
    System.out.println("United States:" + df.format(date));
  }
}

The output:


Japan:10/10/30
Korea:2010. 10. 30
United Kingdom:30 October 2010
United States:Saturday, October 30, 2010
Home 
  Java Book 
    Essential Classes  

DataFormat:
  1. DataFormat class
  2. Create new DateFormat instance
  3. Constants from DateFormat
  4. Format a date
  5. Get all locales
  6. Parse string to get Date