標題:
1231 jva102 時間
[打印本頁]
作者:
b790113g
時間:
2011-12-31 09:56
標題:
1231 jva102 時間
Date d = Calendar.getInstance().getTime();
SimpleDateFormat sdf1=new ("yyyy");
System.out.println(sdf1.format(d));
複製代碼
作者:
johnson
時間:
2011-12-31 10:44
import java.util.*; //Date
# j+ U/ B7 r* Y# G4 f! m
import java.text.*; //SimpleDateFormat
6 t9 i1 H. K! p% N" `; g. T
0 T5 Y' E4 I- e9 T
public class j102{
' p% Q& S. p* K$ X
% D* c( Z) P, W1 C
public static void main(String arg[]){
1 _9 p: i+ H( U
System.out.println("------------------");
+ Q4 t6 Z0 P+ S( I7 U
System.out.println(" 當地時間 ");
2 F, X6 J' w% b. V3 {- a
System.out.println("------------------");
9 u r7 t0 ~/ p
Date d = Calendar.getInstance().getTime();
$ q/ Z6 a* R1 H6 S
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");
4 {8 w5 ~ r/ |5 G/ C8 O
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");
0 ?) B% r# ~: V! d4 F! {
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");
7 G' B+ E# d9 }( L$ a. M" x
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");
; G9 w" q) j6 c: z2 r. m i
System.out.println(sdf1.format(d));
% v3 n5 Z% e' }6 g1 {; w+ O* l2 y
System.out.println(sdf2.format(d));
3 ], K2 L) g+ l& |
System.out.println(sdf3.format(d));
( _4 y: E* A: G' m2 U1 M! F! u
System.out.println(sdf4.format(d));
4 o3 i0 o1 v5 ^$ K8 C4 v3 s0 y" Q
}
* |. G& g9 T# j9 y% \! m) _, b& f
}
作者:
eric5802
時間:
2011-12-31 10:45
import java.util.*; //Date
* U) r; k, m. [$ b3 n! P/ t
import java.text.*; //SimpleDateFormat
' t B7 A2 e, b% u m5 C
; H/ ]3 H( s, t0 T1 q
public class j102{
2 i j4 Y8 L3 o0 @
' k( a5 H6 y6 S) N+ B4 ?+ K% Q
public static void main(String arg[]){
1 L. `1 b; D1 o8 ^
System.out.println("------------------");
$ K0 [ D" Y4 r! ~0 f
System.out.println(" 當地時間拉 ");
" r* u# o8 |# u$ }( I8 @
System.out.println("------------------");
) ~' U& ~) P v( ?/ V
Date d = Calendar.getInstance().getTime();
, K0 p8 z5 [! \# T2 W
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy/M/d a hh:mm");
% Y. O& k9 Q" G9 a% F. s# h
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy/M/d a hh:mm:ss");
3 O% u" I; E- D+ n5 H# e3 B
SimpleDateFormat sdf3 = new SimpleDateFormat("yyyy年M月d日 ahh時mm分ss秒");
6 F4 s# E. [- A, @3 L' a
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E ahh時mm分ss秒 z");
+ |1 m' s) v, S4 m/ _/ c Z% z4 X
System.out.println(sdf1.format(d));
1 h/ }; J* I" ?) ~% l6 d6 k1 K) [
System.out.println(sdf2.format(d));
; h3 W! B% [ E5 j2 K# @
System.out.println(sdf3.format(d));
/ g9 [7 O( B9 i7 Y: _5 N8 C. W, g
System.out.println(sdf4.format(d));
; w+ O4 g0 e# F" _
}
9 N; n+ ^; H# e2 ]/ V4 P- h' q- j
}
作者:
kim
時間:
2011-12-31 10:46
本帖最後由 kim 於 2012-7-27 20:28 編輯
! t$ A! t8 J) ?9 z* }
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 編輯
3 k7 b- f! a4 R
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")
SimpeDateFormat sdf3=new SimpeDateFormat("yyyy年M月d日 ahh時mm分ss秒")
SimpeDateFormat sdf4=new SimpeDateFormat("yyyy年M月d日 E ahh時mm分ss秒")
System.out.println(sdf1.fotmat(d));
System.out.println(sdf2.fotmat(d));
System.out.println(sdf3.fotmat(d));
System.out.println(sdf4.fotmat(d));
}
}
複製代碼
作者:
may
時間:
2011-12-31 11:21
import java.util.*; //Date
import java.text.*; //SimpleDateFormat
public class jva102{
public static void main(String arg[]){
//Date d = new Date(); //新產生物件 可指定時間 () 內可帶參數
// 取得日曆物件裡的實際系統時間
Date d = Calendar.getInstance().getTime();
//基本日期格式化
System.out.println(" 當地時間");
System.out.println("-------------------------");
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日 a hh時mm分ss秒");
SimpleDateFormat sdf4 = new SimpleDateFormat("yyyy年M月d日 E a hh時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));
}
}
複製代碼
作者:
lon
時間:
2012-1-7 09:58
[attach]567[/attach]
歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://seed.istak.org.tw/)
Powered by Discuz! 7.2