返回列表 發帖
import java.util.*; //Date- T. v, b" u' G+ {
import java.text.*; //SimpleDateFormat
5 D1 F6 p# q- W% I, }+ i+ u+ L$ o& c( u* `+ o' B+ b9 L1 s+ v
public class j102{+ }3 {! ~) c) d, m3 [% Y
! K$ t% {  t- g* Q3 P2 ]0 S
        public static void main(String arg[]){3 N* h+ Y7 W8 H7 x- w& P. H$ A
                    System.out.println("------------------");
5 a0 s' u3 s) \+ H                    System.out.println("     當地時間拉     ");
0 N" @; w  C8 Z) I3 B                    System.out.println("------------------");8 r' O& ~* e" ]# B4 ]* _8 Y( \$ j
                Date d = Calendar.getInstance().getTime();) V) ]7 G; L8 A- u
                SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");. ]( R/ f" n. L% ^
                                SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");8 a" S. y) E& \, d
                                SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");
7 `, |- q' S8 j, p; j                                SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");, R" E1 A9 o9 k$ l
                System.out.println(sdf1.format(d));3 k' Z) s( k3 H9 }4 Z; W0 [
                                System.out.println(sdf2.format(d));
: C* b% ~8 G( k7 a9 e% q. e/ ^                                System.out.println(sdf3.format(d));* N( I3 o: ]; y: y
                                System.out.println(sdf4.format(d));8 ~' ?: I+ U+ u- Z# \
        }9 }2 r& t/ h& U+ a/ Z0 F
}
人平

TOP

返回列表