Type | Field | Summary |
---|---|---|
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. |
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. |
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
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. |