本文整理匯總了Java中java.text.SimpleDateFormat.setNumberFormat方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleDateFormat.setNumberFormat方法的具體用法?Java SimpleDateFormat.setNumberFormat怎麽用?Java SimpleDateFormat.setNumberFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.text.SimpleDateFormat
的用法示例。
在下文中一共展示了SimpleDateFormat.setNumberFormat方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: main
import java.text.SimpleDateFormat; //導入方法依賴的package包/類
/**
* Some test code.
*
* @param args ignored.
*/
public static void main(String[] args) {
MonthDateFormat mdf = new MonthDateFormat(Locale.UK, 2);
System.out.println("UK:");
System.out.println(mdf.format(new Month(1, 2005).getStart()));
System.out.println(mdf.format(new Month(2, 2005).getStart()));
System.out.println(mdf.format(new Month(3, 2005).getStart()));
System.out.println(mdf.format(new Month(4, 2005).getStart()));
System.out.println(mdf.format(new Month(5, 2005).getStart()));
System.out.println(mdf.format(new Month(6, 2005).getStart()));
System.out.println(mdf.format(new Month(7, 2005).getStart()));
System.out.println(mdf.format(new Month(8, 2005).getStart()));
System.out.println(mdf.format(new Month(9, 2005).getStart()));
System.out.println(mdf.format(new Month(10, 2005).getStart()));
System.out.println(mdf.format(new Month(11, 2005).getStart()));
System.out.println(mdf.format(new Month(12, 2005).getStart()));
System.out.println();
mdf = new MonthDateFormat(Locale.GERMANY, 2);
System.out.println("GERMANY:");
System.out.println(mdf.format(new Month(1, 2005).getStart()));
System.out.println(mdf.format(new Month(2, 2005).getStart()));
System.out.println(mdf.format(new Month(3, 2005).getStart()));
System.out.println(mdf.format(new Month(4, 2005).getStart()));
System.out.println(mdf.format(new Month(5, 2005).getStart()));
System.out.println(mdf.format(new Month(6, 2005).getStart()));
System.out.println(mdf.format(new Month(7, 2005).getStart()));
System.out.println(mdf.format(new Month(8, 2005).getStart()));
System.out.println(mdf.format(new Month(9, 2005).getStart()));
System.out.println(mdf.format(new Month(10, 2005).getStart()));
System.out.println(mdf.format(new Month(11, 2005).getStart()));
System.out.println(mdf.format(new Month(12, 2005).getStart()));
System.out.println();
mdf = new MonthDateFormat(Locale.FRANCE, 2);
System.out.println("FRANCE:");
System.out.println(mdf.format(new Month(1, 2005).getStart()));
System.out.println(mdf.format(new Month(2, 2005).getStart()));
System.out.println(mdf.format(new Month(3, 2005).getStart()));
System.out.println(mdf.format(new Month(4, 2005).getStart()));
System.out.println(mdf.format(new Month(5, 2005).getStart()));
System.out.println(mdf.format(new Month(6, 2005).getStart()));
System.out.println(mdf.format(new Month(7, 2005).getStart()));
System.out.println(mdf.format(new Month(8, 2005).getStart()));
System.out.println(mdf.format(new Month(9, 2005).getStart()));
System.out.println(mdf.format(new Month(10, 2005).getStart()));
System.out.println(mdf.format(new Month(11, 2005).getStart()));
System.out.println(mdf.format(new Month(12, 2005).getStart()));
System.out.println();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
sdf.setNumberFormat(null);
System.out.println(sdf.equals("X"));
}