import java.util.*; //Date4 Y7 S4 p" H. @1 T* f
import java.text.*; //SimpleDateFormat
5 O) p) y2 B, i. Y8 ]
- t7 O; x+ _: Xpublic class j102{
( n# Y* P4 d I( I9 i, X' w
* M$ d/ r5 M3 K, T public static void main(String arg[]){
9 I2 @! h1 Z) v# S System.out.println("------------------");
4 ]$ M( ~/ X7 Z System.out.println(" 當地時間拉 ");
5 s$ _/ g0 x- M% q4 l5 v' @& } System.out.println("------------------");. b4 k, o& p$ ~' A, m
Date d = Calendar.getInstance().getTime();5 D3 Q0 f4 b5 i/ {$ y
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");
3 V: d& x5 |* N SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");
, s2 v# C' j- m% H6 d SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");- r) q% N- r5 O! @* w ?% e
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");
( D. R0 m) q6 z W( z System.out.println(sdf1.format(d));" h% K' `6 b" p+ Y
System.out.println(sdf2.format(d));% A9 Q" F f( l8 o5 Z* N, D# J5 c1 P
System.out.println(sdf3.format(d));: D/ Z- {7 W6 r+ j* Z0 |. F
System.out.println(sdf4.format(d));
0 C) Y* N$ Q* v/ i( E5 l5 q5 ] }( w( u2 V* Y# `# J5 v5 ]9 s* a" W
} |