分页: 1 / 1

[问题]怎么解决啊!月份不对啊!

发表于 : 2008-05-30 11:41
core
这是我写的收邮件程序的一部分!
对比时间代码的 输出也写在这里!
可这个时间转完了月份怎么就是不对啊!

if (message.getSentDate() != null) { System.out.println(message.getSentDate());
System.out.println(new Date());
System.out.println(new SimpleDateFormat(
"yyyy-mm-dd hh:mm:ss").format(new Date()));
msgdb.setSendtime(new SimpleDateFormat(
"yyyy-mm-dd hh:mm:ss").format(message
.getSentDate()));
System.out.println(new SimpleDateFormat(
"yyyy-mm-dd hh:mm:ss").format(message
.getSentDate()));
}


输出结果却是这个!


Tue May 27 16:35:44 CST 2008
Fri May 30 11:35:17 CST 2008
2008-35-30 11:35:17
2008-35-27 04:35:44


高手解释下!

发表于 : 2008-05-30 11:56
core
奶奶的
结贴!
希望后辈少走弯路!
SimpleDateFormat( "yyyy-MM-dd HH:mm:ss")
大小写的问题!
郁闷!