Hi,
Folowing is my senario,
1) I am reading Form input text field 'Date' as
String str1=request.getParameter("Date");
which accepts input in yyyymmdd format.
eg: str1="20020422"
2) I want to store this Date into table with column type Date
AssignedOn Date
3)I am using PrepareStatement to insert values into table.
setDate(1,Datevar)
problem here is Datevar must be sql.Date type
4)I am converting String to sql Date as
Long l1=new Long(str1);
long l2=l1.longValue();
Date d1= new Date(l2);
System.out.println("long value:"+ l2);
System.out.println("Date:"+ d1.toString());
First print prints:long value:4122002
Second prints : Date:1969-12-31
Why it is taking wired value?
I even try by giving String in 'mmddyyyy' format
it prints 1969-12-31.
what's happening here?
Please let me any one knows any other way to store Date value(which is from htnl form) in table.
Thanks,
padmashree
[ April 22, 2002: Message edited by: padma patil ]