date型数据的打印问题? System.out.println();这个函数是打印字符串的不可以打印日期可以类型转换 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //jdk 1.5System.out.printf("%tc", new Date());===>星期四 四月 21 11:56:48 CST 2005其中t后面的那个字母可以:c Complete date and time Mon Feb 09 18:05:19 PST 2004 F ISO 8601 date 2004-02-09 D U.S. formatted date (month/day/year) 02/09/2004 T 24-hour time 18:05:19 r 12-hour time 06:05:19 pm R 24-hour time, no seconds 18:05 Y Four-digit year (with leading zeroes) 2004 y Last two digits of the year (with leading zeroes) 04 C First two digits of the year (with leading zeroes) 20 B Full month name February b or h Abbreviated month name Feb m Two-digit month (with leading zeroes) 02 d Two-digit day (with leading zeroes) 09 e Two-digit day (without leading zeroes) 9 A Full weekday name Monday a Abbreviated weekday name Mon j Three-digit day of year (with leading zeroes), between 001 and 366 069 H Two-digit hour (with leading zeroes), between 00 and 23 18 k Two-digit hour (without leading zeroes), between 0 and 23 18 I Two-digit hour (with leading zeroes), between 01 and 12 06 l Two-digit hour (without leading zeroes), between 1 and 12 6 M Two-digit minutes (with leading zeroes) 05 S Two-digit seconds (with leading zeroes) 19 L Three-digit milliseconds (with leading zeroes) 047 N Nine-digit nanoseconds (with leading zeroes) 047000000 P Uppercase morning or afternoon er PM p Lowercase morning or afternoon er pm z RFC 822 numeric offset from GMT -0800 Z Time zone PST s Seconds since 1970-01-01 00:00:00 GMT 1078884319 E Milliseconds since 1970-01-01 00:00:00 GMT 1078884319047 .toString()就好啊。或者将date传入calendar,自己组织打印的格式。 toString()不好使,enrico的才是正解。 一道JAVA多线程题 如何输出文档的时候可以跟在原文档内容的后面 在线急求:Java怎么把数字字符型数组中的数字字符转为整型? java写的记事本,找不到变量怎么办 运行出来是0????????????不是435? 在做0.1+0.1的连加运算时,由于double的不精确性,在执行三四次时就会出现不精确的结果,该怎么办? 如何关闭URLConnection对像啊? 1000分,散了 谁知道这是什么问题? 怪事: 是谁设置了Classpath? 关于 if (a=null || a.length() = 0) 能否在SQL Server中存取自定义对象?
System.out.printf("%tc", new Date());===>
星期四 四月 21 11:56:48 CST 2005其中t后面的那个字母可以:c
Complete date and time
Mon Feb 09 18:05:19 PST 2004
F
ISO 8601 date
2004-02-09
D
U.S. formatted date (month/day/year)
02/09/2004
T
24-hour time
18:05:19
r
12-hour time
06:05:19 pm
R
24-hour time, no seconds
18:05
Y
Four-digit year (with leading zeroes)
2004
y
Last two digits of the year (with leading zeroes)
04
C
First two digits of the year (with leading zeroes)
20
B
Full month name
February
b or h
Abbreviated month name
Feb
m
Two-digit month (with leading zeroes)
02
d
Two-digit day (with leading zeroes)
09
e
Two-digit day (without leading zeroes)
9
A
Full weekday name
Monday
a
Abbreviated weekday name
Mon
j
Three-digit day of year (with leading zeroes), between 001 and 366
069
H
Two-digit hour (with leading zeroes), between 00 and 23
18
k
Two-digit hour (without leading zeroes), between 0 and 23
18
I
Two-digit hour (with leading zeroes), between 01 and 12
06
l
Two-digit hour (without leading zeroes), between 1 and 12
6
M
Two-digit minutes (with leading zeroes)
05
S
Two-digit seconds (with leading zeroes)
19
L
Three-digit milliseconds (with leading zeroes)
047
N
Nine-digit nanoseconds (with leading zeroes)
047000000
P
Uppercase morning or afternoon er
PM
p
Lowercase morning or afternoon er
pm
z
RFC 822 numeric offset from GMT
-0800
Z
Time zone
PST
s
Seconds since 1970-01-01 00:00:00 GMT
1078884319
E
Milliseconds since 1970-01-01 00:00:00 GMT
1078884319047