dateexample.java
来自「云网论坛CWBBS 源码,内容丰富,学习,参考,教学的好资料,具体见内说明,」· Java 代码 · 共 27 行
JAVA
27 行
package com.redmoon.forum.test;
import java.text.*;
import java.util.*;
import java.util.Date;
public class DateExample {
public static void main(String args[]) {
// Get the Date
Date now = new Date();
// Get date formatters for default, German, and French locales
DateFormat theDate = DateFormat.getDateInstance(DateFormat.MEDIUM);
DateFormat dateTimeFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT,
DateFormat.MEDIUM);
DateFormat germanDate = DateFormat.getDateInstance(DateFormat.LONG, Locale.GERMANY);
DateFormat frenchDate = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
// Format and print the dates
System.out.println("Date in the default locale: " + theDate.format(now));
System.out.println("Date time in the default locale: " + dateTimeFormat.format(now));
System.out.println("Date in the German locale : " + germanDate.format(now));
System.out.println("Date in the French locale : " + frenchDate.format(now));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?