?? trydateformats.java
字號:
// Trying date formatting
import java.util.*;
import java.text.*;
public class TryDateFormats
{
public static void main(String[] args)
{
Date today = new Date();
Locale[] locales = {Locale.US, Locale.UK,
Locale.GERMANY, Locale.FRANCE };
int[] styles = { DateFormat.FULL,DateFormat.LONG,
DateFormat.MEDIUM,DateFormat.SHORT};
DateFormat fmt;
String[] styleText = { "FULL", "LONG", "MEDIUM", "SHORT"};
// Output the date for each local in four styles
for(int i = 0; i < locales.length; i++)
{
System.out.println("\nThe Date for " +
locales[i].getDisplayCountry() + ":");
for(int j = 0; j < styles.length; j++)
{
fmt = DateFormat.getDateInstance(styles[j], locales[i]);
System.out.println( "\tIn " + styleText[j] +
" is " + fmt.format(today));
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -