java.sql.Date has just 2 constructors:
Date(int year, int month, int day)
Deprecated. instead use the constructor Date(long date)
Date(long date)
Constructs a Date object using a milliseconds time value.
None of them seem to satisfy java.sql.Date sqlDate = new
java.sql.Date(birthday.getTime());
Emma
-----Original Message-----
From: zlatko [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 07, 2002 11:04 AM
To: JDJList
Subject: [jdjlist] Re: sql Date
You have to create new java.sql.Date instance to do it :
java.sql.Date sqlDate = new java.sql.Date(birthday.getTime());
and to pass it as parameter of the setDate(java.sql.Date) method
----- Original Message -----
From: "Emmanuel Eze" <[EMAIL PROTECTED]>
To: "JDJList" <[EMAIL PROTECTED]>
Sent: Tuesday, May 07, 2002 11:03 AM
Subject: [jdjlist] sql Date
> Hi all,
>
> Can somebody pls tell me how I can insert a Date type into a database
table
> with a Date datatype?
>
> I have the year, month, and day as interger values. I need to convert
these
> values into an sql Date object so I can now insert the Date object into
the
> table, right?
>
> I have the folllowing code:
> Calendar cbirthday = null;
> java.util.sql birthday = null;
> .
> .
> .
> cbirthday = Calendar.getInstance();
> cbirthday.set(Integer.parseInt(year), Integer.parseInt(month),
> Integer.parseInt(day));
> birthday = cbirthday.getTime();
>
> This last statement throws a cast exception! Even when I chnage it to:
> birthday = (java.sql.Date) cbirthday.getTime();
>
> Pls tell me what I'm doing wrongly.
>
> Emma
>
>
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
>
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm