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

sdf.parse(rs.getTimeStamp("yourDateColumn"));
what is rs.  
coolgemAsked:
Who is Participating?
 
InteractiveMindConnect With a Mentor Commented:
Hm, I'm still not 100% clear (sorry, am quite tired :P).

Show me what you've currently got -- I'm sure that'll clarify some things for me.
0
 
InteractiveMindCommented:
It would appear to be a ResultSet instance.
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html
0
 
InteractiveMindCommented:
It's merely a class typically used to encapsulate the returned data (the result set) of a query, performed on a database for example.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
coolgemAuthor Commented:
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
0
 
InteractiveMindCommented:
SimpleDateformat sdf = new SimpleDateformat( "dd MMM yyyy" ) ;

Date d = sdf.parse(rs.getTimeStamp("yourDateColumn")) ;
0
 
InteractiveMindCommented:
(Should of course be "SimpleDateFormat" instead)
                                                ^
                                            capital F
0
 
coolgemAuthor Commented:
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.
0
 
coolgemAuthor Commented:
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
0
 
InteractiveMindCommented:
I assume you got it working then?

Thanks for points :)
0
 
coolgemAuthor Commented:
You are welcome. You are always a great help. CG
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.