import java.util.*; //Date
) g) `. P1 X. ]/ W# [' gimport java.text.*; //SimpleDateFormat0 Z$ t: B1 [6 V q) v
( i' F8 ^( h, @9 Y' ppublic class j102{
- D Q# g2 X. u# j# S9 S9 Q+ N. a! i: R/ ^/ l
public static void main(String arg[]){- R2 K" U# J, K& I) ?! v$ L& Y' J
System.out.println("------------------");5 q3 K H5 n& K/ K" K
System.out.println(" 當地時間拉 ");
, K9 Q( Z7 X5 o# u3 a System.out.println("------------------");: J' w) a3 H- E/ h k. y. f* Z
Date d = Calendar.getInstance().getTime();) _: p g/ O9 b4 l- a
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");; V6 |0 k r; i3 i6 V
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");" N g. X' B) Y4 u- k h; U' g/ U
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");: Y( Q/ u5 q4 ]
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");6 B. I) s9 ?( G* m( q$ f. ]& B3 U0 |
System.out.println(sdf1.format(d));
6 R; f+ N5 T! Y8 E5 [: |( w System.out.println(sdf2.format(d));/ p$ X+ N ?0 B: q
System.out.println(sdf3.format(d));, v: t" {8 q- l' ?( T
System.out.println(sdf4.format(d));
9 I9 q C3 c/ J% o; n }& @; h% \9 Z, |5 A' j
} |