import java.util.*; //Date
9 ^( @6 v" h! `6 O1 Cimport java.text.*; //SimpleDateFormat
5 q. L2 D$ E3 g- z) b$ w) z, K7 K( |5 n, K) _) ^
public class j102{. D% u- I! k; X) d4 [$ ]1 N
+ w8 L% B/ \7 I public static void main(String arg[]){
; s+ b9 [# L* F" {0 h System.out.println("------------------");2 A3 }( B" ?, }9 _+ Q# X
System.out.println(" 當地時間 ");& M* I9 W" @+ |6 t* v. O% W
System.out.println("------------------");+ M, p$ S# n- [
Date d = Calendar.getInstance().getTime();! \9 v. M$ X7 d3 F- ?
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");
. d+ ]$ v3 L- y+ q: I6 G SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");% f0 Q; f* M+ S% Z
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");
& S, j0 l3 c X& z, E1 q SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");! d# u8 L! Y! @$ T( y# N, w
System.out.println(sdf1.format(d));2 [, @7 w9 w( T* i
System.out.println(sdf2.format(d));
6 n! Z7 ?% b0 b% S" c, ^$ x! S5 f& r System.out.println(sdf3.format(d));
0 U5 f- E* g. Z System.out.println(sdf4.format(d));2 m- u& V! K0 D7 s
}% N! b, q Q. F6 C+ w
} |