import java.util.*; //Date 3 \4 B5 b' S. E7 U+ D% r& Simport java.text.*; //SimpleDateFormat% h# ^# |9 u) g$ t8 \" e: Z- L
2 O3 m3 G7 O' B A& L& hpublic class j102{1 N5 T# |) M) x+ N1 c4 D5 W
O ~! k0 `/ F3 G3 i, ]
public static void main(String arg[]){5 r! x0 F6 R- n
System.out.println("------------------"); . W* Z& o8 w+ Y) }- a3 O System.out.println(" 當地時間 "); 6 z7 s) ?- I2 w- }! A System.out.println("------------------");" H& {: b+ I7 K- a
Date d = Calendar.getInstance().getTime(); ' S2 T9 n- H5 b7 C* l, e SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm"); 8 [1 t. [1 A! [- H S1 m SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss"); * w. t0 n0 u/ i! u SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒"); : l/ x5 U ~ g1 B* c SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");$ f8 Q6 R& @3 V( c- r: w( \
System.out.println(sdf1.format(d));+ `6 b0 q% F6 T$ B y& q
System.out.println(sdf2.format(d)); 3 h, N. W# n G B( ~/ X System.out.println(sdf3.format(d));+ [$ E2 X+ X, W
System.out.println(sdf4.format(d));9 ] S e9 d! i; m5 q9 s1 E4 R
}4 [2 O. w# {. F' [' X% h) }
}作者: eric5802 時間: 2011-12-31 10:45
import java.util.*; //Date' h; Y1 r/ ^* L4 \+ x
import java.text.*; //SimpleDateFormat f, l* I$ U; V/ G
' r* n7 [: S# `8 X$ W
public class j102{0 L- x( h* c3 b7 Q
/ Y: A5 ?0 I4 [2 G3 t public static void main(String arg[]){* a4 A8 `4 z( u1 I V/ Z
System.out.println("------------------");1 V' x6 [5 ^& Q9 f0 U
System.out.println(" 當地時間拉 "); # _$ m; Y* x4 F8 m$ m System.out.println("------------------"); 5 N2 R& w$ O! G8 ~$ w+ b1 F Date d = Calendar.getInstance().getTime();) P% n5 l" ]; a6 K
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm"); # R. p( [! a) A/ J. Y) _6 F SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss"); 5 b) g1 C: u2 {( K5 F% @1 i SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒"); ) z3 o% O+ |& P- V ~ SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");) c, z7 X$ h0 K7 @+ o! _: i+ o( K
System.out.println(sdf1.format(d));4 h' L7 Q- R' H: Q) ^" |
System.out.println(sdf2.format(d));9 q* K/ z' C. ^3 h; a- M
System.out.println(sdf3.format(d));4 C" X7 j, r) z' B9 M+ o
System.out.println(sdf4.format(d));/ B& g8 x; A! L m! s: I7 d3 D+ ^& q
}( _9 E- h& S+ d, f7 k/ N8 U
}作者: kim 時間: 2011-12-31 10:46
本帖最後由 kim 於 2012-7-27 20:28 編輯 1 r% d/ e! k! ]* O% |5 O; r
import java.util.*; //Date
import java.text.*; //SimpleDateFormat
public class j102{
public static void main(String arg[]){
System.out.println("------------------");
System.out.println(" 當地時間 ");
System.out.println("------------------");
Date d = Calendar.getInstance().getTime();
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");
System.out.println(sdf1.format(d));
System.out.println(sdf2.format(d));
System.out.println(sdf3.format(d));
System.out.println(sdf4.format(d));
}
}
複製代碼
作者: TOM 時間: 2011-12-31 10:52
本帖最後由 TOM 於 2011-12-31 11:07 編輯 : O9 u# e( X+ S+ L
import java.util.* ;
import java text.*;
public class j103
{
public static void main(Sting[]arg)
{
System.out.println("------------------");
System.out.println(" 當地時間拉 ");
System.out.println("------------------");
Date d=Calendar.getInstance.getTime();
SimpeDateFormat sdf1=new SimpeDateFormat("yyyy/M/d a hh:mm")
SimpeDateFormat sdf2=new SimpeDateFormat("yyyy/M/d a hh:mm:ss")