Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 359
  • Last Modified:

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

sdf.parse(rs.getTimeStamp("yourDateColumn"));
what is rs.  
0
coolgem
Asked:
coolgem
  • 6
  • 4
1 Solution
 
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
 
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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
 
InteractiveMindCommented:
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
 
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

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now