Link to home
Start Free TrialLog in
Avatar of coolgem
coolgem

asked on

JAVA:Please explain:sdf.parse(rs.getTimeStamp("yourDateColumn"));

sdf.parse(rs.getTimeStamp("yourDateColumn"));
what is rs.  
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

It would appear to be a ResultSet instance.
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html
It's merely a class typically used to encapsulate the returned data (the result set) of a query, performed on a database for example.
Avatar of coolgem
coolgem

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
SimpleDateformat sdf = new SimpleDateformat( "dd MMM yyyy" ) ;

Date d = sdf.parse(rs.getTimeStamp("yourDateColumn")) ;
(Should of course be "SimpleDateFormat" instead)
                                                ^
                                            capital F
Avatar of coolgem

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.
ASKER CERTIFIED SOLUTION
Avatar of InteractiveMind
InteractiveMind
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of coolgem

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
I assume you got it working then?

Thanks for points :)
Avatar of coolgem

ASKER

You are welcome. You are always a great help. CG