DateFormat
1. DateFormat 介紹
DateFormat 的作用是 格式化并解析“日期/時間”。實際上,它是Date的格式化工具,它能幫助我們格式化Date,進而將Date轉換成我們想要的String字符串供我們使用
不過DateFormat的格式化Date的功能有限,沒有SimpleDateFormat強大;但DateFormat是SimpleDateFormat的父類。所以,我們先對DateFormat有個整體了解,然后再學習SimpleDateFormat。
DateFormat 的作用是格式化Date。它支持格式化風格包括 FULL、LONG、MEDIUM 和 SHORT 共4種:
(01) DateFormat.SHORT
完全為數字,如 12.13.52 或 3:30pm
(02) DateFormat.MEDIUM
較長,如 Jan 12, 1952
(03) DateFormat.LONG
更長,如 January 12, 1952 或 3:30:32pm
(04) DateFormat.FULL
是完全指定,如 Tuesday、April 12、1952 AD 或 3:30:42pm PST。
DateFormat 的定義如下
public abstract class NumberFormat extends Format {}
DateFormat 的函數接口
默認構造函數:
DateFormat()
非構造函數:
Object clone()boolean equals(Object object)abstract StringBuffer format(Date date, StringBuffer buffer, FieldPosition field)final StringBuffer format(Object object, StringBuffer buffer, FieldPosition field)final String format(Date date)static Locale[] getAvailableLocales()Calendar getCalendar()final static DateFormat getInstance()final static DateFormat getDateInstance()final static DateFormat getDateInstance(int style)final static DateFormat getDateInstance(int style, Locale locale)final static DateFormat getTimeInstance()final static DateFormat getTimeInstance(int style)final static DateFormat getTimeInstance(int style, Locale locale)final static DateFormat getDateTimeInstance()final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle)final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)NumberFormat getNumberFormat()TimeZone getTimeZone()int hashCode()boolean isLenient()Date parse(String string)abstract Date parse(String string, ParsePosition position)Object parseObject(String string, ParsePosition position)void setCalendar(Calendar cal)void setLenient(boolean value)void setNumberFormat(NumberFormat format)void setTimeZone(TimeZone timezone)
注意:DateFormat是一個抽象類。
當我們通過DateFormat的 getInstance(), getDateInstance()和getDateTimeInstance() 獲取DateFormat實例時;實際上是返回的SimpleDateFormat對象。
下面的函數實際上都是返回的SimpleDateFormat對象。
final static DateFormat getInstance()final static DateFormat getTimeInstance()final static DateFormat getTimeInstance(int style)final static DateFormat getTimeInstance(int style, Locale locale)final static DateFormat getDateInstance()final static DateFormat getDateInstance(int style)final static DateFormat getDateInstance(int style, Locale locale)final static DateFormat getDateTimeInstance()final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle)final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale)
這些函數在SimpleDateFormat.java中的定義如下:
public static final int FULL = 0;public static final int LONG = 1;public static final int MEDIUM = 2;public static final int SHORT = 3;public static final int DEFAULT = MEDIUM;public final static DateFormat getInstance() { return getDateTimeInstance(SHORT, SHORT);}public final static DateFormat getTimeInstance(){ return get(DEFAULT, 0, 1, Locale.getDefault());}public final static DateFormat getTimeInstance(int style){ return get(style, 0, 1, Locale.getDefault());}public final static DateFormat getTimeInstance(int style, Locale aLocale){ return get(style, 0, 1, aLocale);}public final static DateFormat getDateInstance(){ return get(0, DEFAULT, 2, Locale.getDefault());}public final static DateFormat getDateInstance(int style){ return get(0, style, 2, Locale.getDefault());}public final static DateFormat getDateInstance(int style, Locale aLocale){ return get(0, style, 2, aLocale);}public final static DateFormat getDateTimeInstance(){ return get(DEFAULT, DEFAULT, 3, Locale.getDefault());}public final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle){ return get(timeStyle, dateStyle, 3, Locale.getDefault());}public final static DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale){ return get(timeStyle, dateStyle, 3, aLocale);}/** * 獲取DateFormat實例,實際上是返回SimpleDateFormat對象。 * * timeStyle -- 值可以為“FULL”或“LONG”或“MEDIUM”或“SHORT” * dateStyle -- 值可以為“FULL”或“LONG”或“MEDIUM”或“SHORT” * flags -- 值可以為“1”或“2”或“3”。 * 1 表示獲取“時間樣式” * 2 表示獲取“日期樣式” * 3 表示獲取“時間和日期樣式” * loc -- locale對象,表示“區域” */private static DateFormat get(int timeStyle, int dateStyle, int flags, Locale loc) { if ((flags & 1) != 0) { if (timeStyle < 0 || timeStyle > 3) { throw new IllegalArgumentException("Illegal time style " + timeStyle); } } else { timeStyle = -1; } if ((flags & 2) != 0) { if (dateStyle < 0 || dateStyle > 3) { throw new IllegalArgumentException("Illegal date style " + dateStyle); } } else { dateStyle = -1; } try { // Check whether a provider can provide an implementation that's closer // to the requested locale than what the Java runtime itself can provide. LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(DateFormatProvider.class); if (pool.hasProviders()) { DateFormat providersInstance = pool.getLocalizedObject( DateFormatGetter.INSTANCE, loc, timeStyle, dateStyle, flags); if (providersInstance != null) { return providersInstance; } } return new SimpleDateFormat(timeStyle, dateStyle, loc); } catch (MissingResourceException e) { return new SimpleDateFormat("M/d/yy h:mm a"); }}通過上面的代碼,我們能夠進一步的認識到:DateFormat的作用是格式化Date;幫助我們將Date轉換成我們需要的String字符串。DateFormat提供的功能非常有限,它只能支持FULL、LONG、MEDIUM 和 SHORT 這4種格式。而且,我們獲取DateFormat實例時,實際上是返回的SimpleDateFormat對象。
2. DateFormat 實例
下面,我們通過實例學習使用DateFormat的常用API。
源碼如下(DateFormatTest.java):
import java.util.Date;import java.util.Locale;import java.text.DateFormat;import java.text.FieldPosition;/** * DateFormat 的API測試程序 */public class DateFormatTest { public static void main(String[] args) { // 只顯示“時間”:調用getTimeInstance()函數 testGetTimeInstance() ; // 只顯示“日期”:調用getDateInstance()函數 testGetDateInstance() ; // 顯示“日期”+“時間”:調用getDateTimeInstance()函數 testGetDateTimeInstance() ; // 測試format()函數 testFormat(); } /** * 測試DateFormat的getTimeInstance()函數 * 它共有3種重載形式: * (01) getTimeInstance() * (02) getTimeInstance(int style) * (03) getTimeInstance(int style, Locale locale) * * @author skywang */ private static void testGetTimeInstance() { Date date = new Date(); //Locale locale = new Locale("fr", "FR"); Locale locale = new Locale("zh", "CN"); // 等價于 DateFormat.getTimeInstance( DateFormat.MEDIUM); DateFormat short0 = DateFormat.getTimeInstance( ); // 參數是:“時間的顯示樣式” DateFormat short1 = DateFormat.getTimeInstance( DateFormat.SHORT); DateFormat medium1 = DateFormat.getTimeInstance( DateFormat.MEDIUM); DateFormat long1 = DateFormat.getTimeInstance( DateFormat.LONG); DateFormat full1 = DateFormat.getTimeInstance( DateFormat.FULL); // 參數是:“時間的顯示樣式” 和 “地區” DateFormat short2 = DateFormat.getTimeInstance( DateFormat.SHORT, locale); DateFormat medium2 = DateFormat.getTimeInstance( DateFormat.MEDIUM, locale); DateFormat long2 = DateFormat.getTimeInstance( DateFormat.LONG, locale); DateFormat full2 = DateFormat.getTimeInstance( DateFormat.FULL, locale); System.out.println("/n----getTimeInstance ----/n" + "(1.0) Empty Param : " + short0.format(date) +"/n" + "(2.1) One Param(s) : " + short1.format(date) +"/n" + "(2.2) One Param(m) : " + medium1.format(date) +"/n" + "(2.3) One Param(l) : " + long1.format(date) +"/n" + "(2.4) One Param(f) : " + full1.format(date) +"/n" + "(3.1) One Param(s,l): " + short2.format(date) +"/n" + "(3.2) One Param(m,l): " + medium2.format(date) +"/n" + "(3.3) One Param(l,l): " + long2.format(date) +"/n" + "(3.4) One Param(f,l): " + full2.format(date) +"/n" ); } /** * 測試DateFormat的getDateTimeInstance()函數 * 它共有3種重載形式: * (01) getDateInstance() * (02) getDateInstance(int style) * (03) getDateInstance(int style, Locale locale) */ public static void testGetDateTimeInstance() { Date date = new Date(); Locale locale = new Locale("zh", "CN"); // 等價于 DateFormat.getDateTimeInstance( DateFormat.MEDIUM); DateFormat short0 = DateFormat.getDateTimeInstance( ); DateFormat short1 = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT); DateFormat medium1 = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.MEDIUM); DateFormat long1 = DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG); DateFormat full1 = DateFormat.getDateTimeInstance( DateFormat.FULL, DateFormat.FULL); DateFormat short2 = DateFormat.getDateTimeInstance( DateFormat.SHORT, DateFormat.SHORT, locale); DateFormat medium2 = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.MEDIUM, locale); DateFormat long2 = DateFormat.getDateTimeInstance( DateFormat.LONG, DateFormat.LONG, locale); DateFormat full2 = DateFormat.getDateTimeInstance( DateFormat.FULL, DateFormat.FULL, locale); System.out.println("/n----getDateTimeInstance ----/n" + "(1.0) Empty Param : " + short0.format(date) +"/n" + "(2.1) One Param(s) : " + short1.format(date) +"/n" + "(2.2) One Param(m) : " + medium1.format(date) +"/n" + "(2.3) One Param(l) : " + long1.format(date) +"/n" + "(2.4) One Param(f) : " + full1.format(date) +"/n" + "(3.1) One Param(s,l): " + short2.format(date) +"/n" + "(3.2) One Param(m,l): " + medium2.format(date) +"/n" + "(3.3) One Param(l,l): " + long2.format(date) +"/n" + "(3.4) One Param(f,l): " + full2.format(date) +"/n" ); } /** * 測試DateFormat的getDateInstance()函數 * 它共有3種重載形式: * (01) getDateTimeInstance() * (02) getDateTimeInstance(int dateStyle, int timeStyle) * (03) getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) */ public static void testGetDateInstance() { Date date = new Date(); //Locale locale = new Locale("en", "US"); Locale locale = new Locale("zh", "CN"); // 等價于 DateFormat.getDateInstance( DateFormat.MEDIUM); DateFormat short0 = DateFormat.getDateInstance( ); DateFormat short1 = DateFormat.getDateInstance( DateFormat.SHORT); DateFormat medium1 = DateFormat.getDateInstance( DateFormat.MEDIUM); DateFormat long1 = DateFormat.getDateInstance( DateFormat.LONG); DateFormat full1 = DateFormat.getDateInstance( DateFormat.FULL); DateFormat short2 = DateFormat.getDateInstance( DateFormat.SHORT, locale); DateFormat medium2 = DateFormat.getDateInstance( DateFormat.MEDIUM, locale); DateFormat long2 = DateFormat.getDateInstance( DateFormat.LONG, locale); DateFormat full2 = DateFormat.getDateInstance( DateFormat.FULL, locale); System.out.println("/n----getDateInstance ----/n" + "(1.0) Empty Param : " + short0.format(date) +"/n" + "(2.1) One Param(s) : " + short1.format(date) +"/n" + "(2.2) One Param(m) : " + medium1.format(date) +"/n" + "(2.3) One Param(l) : " + long1.format(date) +"/n" + "(2.4) One Param(f) : " + full1.format(date) +"/n" + "(3.1) One Param(s,l): " + short2.format(date) +"/n" + "(3.2) One Param(m,l): " + medium2.format(date) +"/n" + "(3.3) One Param(l,l): " + long2.format(date) +"/n" + "(3.4) One Param(f,l): " + full2.format(date) +"/n" ); } /** * 測試DateFormat的format()函數 */ public static void testFormat() { Date date = new Date(); StringBuffer sb = new StringBuffer(); FieldPosition field = new FieldPosition(DateFormat.YEAR_FIELD); DateFormat format = DateFormat.getDateTimeInstance(); sb = format.format(date, sb, field); System.out.println("/ntestFormat"); System.out.printf("sb=%s/n", sb); }}運行結果:
----getTimeInstance ----(1.0) Empty Param : 4:54:22 PM(2.1) One Param(s) : 4:54 PM(2.2) One Param(m) : 4:54:22 PM(2.3) One Param(l) : 4:54:22 PM CST(2.4) One Param(f) : 4:54:22 PM CST(3.1) One Param(s,l): 下午4:54(3.2) One Param(m,l): 16:54:22(3.3) One Param(l,l): 下午04時54分22秒(3.4) One Param(f,l): 下午04時54分22秒 CST----getDateInstance ----(1.0) Empty Param : Jan 23, 2014(2.1) One Param(s) : 1/23/14(2.2) One Param(m) : Jan 23, 2014(2.3) One Param(l) : January 23, 2014(2.4) One Param(f) : Thursday, January 23, 2014(3.1) One Param(s,l): 14-1-23(3.2) One Param(m,l): 2014-1-23(3.3) One Param(l,l): 2014年1月23日(3.4) One Param(f,l): 2014年1月23日 星期四----getDateTimeInstance ----(1.0) Empty Param : Jan 23, 2014 4:54:23 PM(2.1) One Param(s) : 1/23/14 4:54 PM(2.2) One Param(m) : Jan 23, 2014 4:54:23 PM(2.3) One Param(l) : January 23, 2014 4:54:23 PM CST(2.4) One Param(f) : Thursday, January 23, 2014 4:54:23 PM CST(3.1) One Param(s,l): 14-1-23 下午4:54(3.2) One Param(m,l): 2014-1-23 16:54:23(3.3) One Param(l,l): 2014年1月23日 下午04時54分23秒(3.4) One Param(f,l): 2014年1月23日 星期四 下午04時54分23秒 CSTtestFormatsb=Jan 23, 2014 4:54:23 PM
OK。至此,對DateFormat的學習到此為止。接下來,我們開始學習SimpleDateFormat,它才是格式化Date需要重點了解的。
SimpleDateFormat
1. SimpleDateFormat 介紹
SimpleDateFormat 是一個格式化Date 以及 解析日期字符串 的工具。它的最常用途是,能夠按照指定的格式來對Date進行格式化,然后我們使用可以格式化Date后得到的字符串。
更嚴格的說,SimpleDateFormat 是一個以與語言環境有關的方式來格式化和解析日期的具體類。它允許進行格式化(日期 -> 文本)、解析(文本 -> 日期)和規范化。
SimpleDateFormat的構造函數:
構造函數
SimpleDateFormat()SimpleDateFormat(String pattern)SimpleDateFormat(String template, DateFormatSymbols value)SimpleDateFormat(String template, Locale locale)
非構造函數
void applyLocalizedPattern(String template)void applyPattern(String template)Object clone()boolean equals(Object object)StringBuffer format(Date date, StringBuffer buffer, FieldPosition fieldPos)AttributedCharacterIterator formatToCharacterIterator(Object object)Date get2DigitYearStart()DateFormatSymbols getDateFormatSymbols()int hashCode()Date parse(String string, ParsePosition position)void set2DigitYearStart(Date date)void setDateFormatSymbols(DateFormatSymbols value)String toLocalizedPattern()String toPattern()
SimpleDateFormat 簡單示范:
// 新建date對象,時間是2013-09-19Date date = new Date(113,8,19); // 新建“SimpleDateFormat對象”,并設置 sdf 的“格式化模式”SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");// 用 sdf 格式化 date,并返回字符串。String str = sdf.format(date); 2. SimpleDateFormat 相關格式說明
2.1 日期和時間模式
日期和時間格式由日期和時間模式 字符串指定。在日期和時間模式字符串中,未加引號的字母 'A' 到 'Z' 和 'a' 到 'z' 被解釋為模式字母,用來表示日期或時間字符串元素。文本可以使用單引號 (') 引起來,以免進行解釋。"''" 表示單引號。所有其他字符均不解釋;只是在格式化時將它們簡單復制到輸出字符串,或者在解析時與輸入字符串進行匹配。
定義了以下模式字母(所有其他字符 'A' 到 'Z' 和 'a' 到 'z' 都被保留):
| 字母 | 日期或時間元素 | 表示 | 示例 |
| G | Era 標志符 | Text | AD |
| y | 年 | Year | 1996; 96 |
| M | 年中的月份 | Month | July; Jul; 07 |
| w | 年中的周數 | Number | 27 |
| W | 月份中的周數 | Number | 2 |
| D | 年中的天數 | Number | 189 |
| d | 月份中的天數 | Number | 10 |
| F | 月份中的星期 | Number | 2 |
| E | 星期中的天數 | Text | Tuesday; Tue |
| a | Am/pm 標記 | Text | PM |
| H | 一天中的小時數(0-23) | Number | 0 |
| k | 一天中的小時數(1-24) | Number | 24 |
| K | am/pm 中的小時數(0-11) | Number | 0 |
| h | am/pm 中的小時數(1-12) | Number | 12 |
| m | 小時中的分鐘數 | Number | 30 |
| s | 分鐘中的秒數 | Number | 55 |
| S | 毫秒數 | Number | 978 |
| z | 時區 | General time zone | Pacific Standard Time; PST; GMT-08:00 |
| Z | 時區 | RFC 822 time zone | -0800 |
| 日期和時間模式 | 結果 |
| "yyyy.MM.dd G 'at' HH:mm:ss z" | 2001.07.04 AD at 12:08:56 PDT |
| "EEE, MMM d, ''yy" | Wed, Jul 4, '01 |
| "h:mm a" | 12:08 PM |
| "hh 'o''clock' a, zzzz" | 12 o'clock PM, Pacific Daylight Time |
| "K:mm a, z" | 0:08 PM, PDT |
| "yyyyy.MMMMM.dd GGG hh:mm aaa" | 02001.July.04 AD 12:08 PM |
| "EEE, d MMM yyyy HH:mm:ss Z" | Wed, 4 Jul 2001 12:08:56 -0700 |
| "yyMMddHHmmssZ" | 010704120856-0700 |
| "yyyy-MM-dd'T'HH:mm:ss.SSSZ" | 2001-07-04T12:08:56.235-0700 |
import java.util.Date;import java.util.Locale;import java.util.Calendar;import java.text.DateFormat;import java.text.SimpleDateFormat;/** * SimpleDateFormat 的API測試程序 * * @author skywang * @email kuiwu-wang@163.com */public class SimpleDateFormatTest { public static void main(String[] args) { // 通過SimpleDateFormat 獲取日期/時間:有多種格式 testSimpleDateFormats() ; // 通過DateFormat 獲取日期/時間 superTest() ; } /** * 通過SimpleDateFormat 獲取日期/時間。有多種格式可以選擇 */ private static void testSimpleDateFormats() { String[] formats = new String[] { "HH:mm", // 14:22 "h:mm a", // 2:22 下午 "HH:mm z", // 14:22 CST "HH:mm Z", // 14:22 +0800 "HH:mm zzzz", // 14:22 中國標準時間 "HH:mm:ss", // 14:22:30 "yyyy-MM-dd", // 2013-09-19 "yyyy-MM-dd HH:mm", // 2013-09-19 14:22 "yyyy-MM-dd HH:mm:ss", // 2013-09-19 14:22:30 "yyyy-MM-dd HH:mm:ss zzzz", // 2013-09-19 14:22:30 中國標準時間 "EEEE yyyy-MM-dd HH:mm:ss zzzz", // 星期四 2013-09-19 14:22:30 中國標準時間 "yyyy-MM-dd HH:mm:ss.SSSZ", // 2013-09-19 14:22:30.000+0800 "yyyy-MM-dd'T'HH:mm:ss.SSSZ", // 2013-09-19T14:22:30.000+0800 "yyyy.MM.dd G 'at' HH:mm:ss z", // 2013.09.19 公元 at 14:22:30 CST "K:mm a", // 2:22 下午, CST "EEE, MMM d, ''yy", // 星期四, 九月 19, '13 "hh 'o''clock' a, zzzz", // 02 o'clock 下午, 中國標準時間 "yyyyy.MMMMM.dd GGG hh:mm aaa", // 02013.九月.19 公元 02:22 下午 "EEE, d MMM yyyy HH:mm:ss Z", // 星期四, 19 九月 2013 14:22:30 +0800 "yyMMddHHmmssZ", // 130919142230+0800 "yyyy-MM-dd'T'HH:mm:ss.SSSZ", // 2013-09-19T14:22:30.000+0800 "EEEE 'DATE('yyyy-MM-dd')' 'TIME('HH:mm:ss')' zzzz", // 星期四 2013-09-19 14:22:30 中國標準時間 }; //Date date = (new Date(0)); // date為1970-01-01 07:00:00 //Date date = Calendar.getInstance().getTime(); // date為當前時間 Date date = new Date(113, 8, 19, 14, 22, 30); // date為2013-09-19 14:22:30 for (String format : formats) { SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.SIMPLIFIED_CHINESE); //SimpleDateFormat sdf = new SimpleDateFormat(format); System.out.format("%30s %s/n", format, sdf.format(date)); } } /** * 通過DateFormat 獲取日期/時間 */ private static void superTest() { // 新建date對象,時間是2013-09-19 14:22:30 // (01) 年=“‘目標年' - 1900”, // (02) 月。 0是一月,1是二月,依次類推。 // (03) 日。 1-31之間的數 Date mDate = new Date(113, 8, 19, 14, 22, 30); Locale locale = new Locale("zh", "CN"); // 14:22:30 String time = DateFormat.getTimeInstance( DateFormat.MEDIUM, Locale.SIMPLIFIED_CHINESE).format(mDate); // 2013-09-19 String date = DateFormat.getDateInstance( DateFormat.MEDIUM, Locale.SIMPLIFIED_CHINESE).format(mDate); // 2013-09-19 14:22:30 String datetime = DateFormat.getDateTimeInstance( DateFormat.MEDIUM, DateFormat.MEDIUM, Locale.SIMPLIFIED_CHINESE).format(mDate); System.out.printf("/ntime=%s/ndate=%s/ndatetime=%s/n",time,date,datetime); }}運行結果:
HH:mm 14:22 h:mm a 2:22 下午 HH:mm z 14:22 CST HH:mm Z 14:22 +0800 HH:mm zzzz 14:22 中國標準時間 HH:mm:ss 14:22:30 yyyy-MM-dd 2013-09-19 yyyy-MM-dd HH:mm 2013-09-19 14:22 yyyy-MM-dd HH:mm:ss 2013-09-19 14:22:30 yyyy-MM-dd HH:mm:ss zzzz 2013-09-19 14:22:30 中國標準時間 EEEE yyyy-MM-dd HH:mm:ss zzzz 星期四 2013-09-19 14:22:30 中國標準時間 yyyy-MM-dd HH:mm:ss.SSSZ 2013-09-19 14:22:30.000+0800 yyyy-MM-dd'T'HH:mm:ss.SSSZ 2013-09-19T14:22:30.000+0800 yyyy.MM.dd G 'at' HH:mm:ss z 2013.09.19 公元 at 14:22:30 CST K:mm a 2:22 下午 EEE, MMM d, ''yy 星期四, 九月 19, '13 hh 'o''clock' a, zzzz 02 o'clock 下午, 中國標準時間 yyyyy.MMMMM.dd GGG hh:mm aaa 02013.九月.19 公元 02:22 下午 EEE, d MMM yyyy HH:mm:ss Z 星期四, 19 九月 2013 14:22:30 +0800 yyMMddHHmmssZ 130919142230+0800 yyyy-MM-dd'T'HH:mm:ss.SSSZ 2013-09-19T14:22:30.000+0800EEEE 'DATE('yyyy-MM-dd')' 'TIME('HH:mm:ss')' zzzz 星期四 DATE(2013-09-19) TIME(14:22:30) 中國標準時間time=14:22:30date=2013-9-19datetime=2013-9-19 14:22:30新聞熱點
疑難解答