How can I set the current date in the format 2007-06-06 for java.sql.Date?
java.sql.Date
Collapse
X
-
Originally posted by DeMansearch java calendar on the net.....it should explain lots
thank you I have done so. i have a small issue now. the following code segment is producing a wrong date on the year.
code: java
int year = cal.get(Calenda r.YEAR);
int month = cal.get(Calenda r.MONTH);
int day = cal.get(Calenda r.DAY_OF_MONTH) ;
....
I am setting the date as below:
preqL.setReceip tDate(new java.sql.Date(y ear,month,day)) ;//preqL is a local object
when I print it in the jsp it shows:: 3907-06-07 instead of 2007-06-07Comment
-
How did you set the date?Originally posted by veremuethank you I have done so. i have a small issue now. the following code segment is producing a wrong date on the year.
code: java
int year = cal.get(Calenda r.YEAR);
int month = cal.get(Calenda r.MONTH);
int day = cal.get(Calenda r.DAY_OF_MONTH) ;
....
I am setting the date as below:
preqL.setReceip tDate(new java.sql.Date(y ear,month,day)) ;//preqL is a local object
when I print it in the jsp it shows:: 3907-06-07 instead of 2007-06-07
use setReceiptDate( Date.valueOf(st ringDate)) to set the date.Comment
Comment