coolgem
asked on
JAVA:Please explain:sdf.parse(rs.getTimeStamp("yourDateColumn"));
sdf.parse(rs.getTimeStamp( "yourDateC olumn"));
what is rs.
what is rs.
It's merely a class typically used to encapsulate the returned data (the result set) of a query, performed on a database for example.
ASKER
Ok. Thank you. will you please explain How I may do a SimpleDateformate to set it to only dd mmm yyyy in a getter method?
Thank you agin for your time
CG
Thank you agin for your time
CG
SimpleDateformat sdf = new SimpleDateformat( "dd MMM yyyy" ) ;
Date d = sdf.parse(rs.getTimeStamp( "yourDateC olumn")) ;
Date d = sdf.parse(rs.getTimeStamp(
(Should of course be "SimpleDateFormat" instead)
^
capital F
^
capital F
ASKER
Why are we using the result set? I did not want to have to do it that way. How about right in the getterMethod(). I dont need a yourDateColumn either. I'm using a name in the getter or right in the setter with the date being a String object.
I apologize for my misunderstanding.
I apologize for my misunderstanding.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
While in a setter and after getting a field as a result of an sql Select. Take the field in the setter and format it with simpleDateformat to "dd MMM yyy". The getter field should look like "dd MMM yyyy".
public void setTheDate(String string) {
theDate = dateFormat.format(string);
}
I'm trying this now.
thank you
public void setTheDate(String string) {
theDate = dateFormat.format(string);
}
I'm trying this now.
thank you
I assume you got it working then?
Thanks for points :)
Thanks for points :)
ASKER
You are welcome. You are always a great help. CG
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html