Topic: java 日期的疑惑 |
Print this page |
1.java 日期的疑惑 | Copy to clipboard |
Posted by: jerry010 Posted on: 2004-09-05 22:11 2004/08/31 经过java.util.Date date = new java.util.Date("2004/08/31");的转换后 成了2004-10-01 高手们,什么原因啊 |
2.Re:java 日期的疑惑 [Re: jerry010] | Copy to clipboard |
Posted by: why Posted on: 2004-09-05 22:41 I don't get this error, can you show us your source code? check http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html#Date(java.lang.String) public Date(String s) Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s). Allocates a Date object and initializes it so that it represents the date and time indicated by the string s, which is interpreted as if by the parse(java.lang.String) method. Parameters: s - a string representation of the date. |
3.Re:java 日期的疑惑 [Re: jerry010] | Copy to clipboard |
Posted by: jerry010 Posted on: 2004-09-06 10:28 不好意思,是我弄错了 问题出在java.sql.Date转换上: java.util.Date date = new java.util.Date("2004/08/31"); java.sql.Date date1 = new java.sql.Date(date.getYear() + 0, date.getMonth() + 1, date.getDate() + 0); 这样转换后得出的是2004-10-01 |
4.Re:java 日期的疑惑 [Re: jerry010] | Copy to clipboard |
Posted by: why Posted on: 2004-09-06 10:48 Please check my reply to the other topic http://www.cjsdn.net/post/view?bid=1&id=109773 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |