Solved

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

Posted on 2006-06-09
10
315 Views
Last Modified: 2008-01-16
sdf.parse(rs.getTimeStamp("yourDateColumn"));
what is rs.  
0
Comment
Question by:coolgem
  • 6
  • 4
10 Comments
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16871759
It would appear to be a ResultSet instance.
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSet.html
0
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16871772
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
 

Author Comment

by:coolgem
ID: 16872274
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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16872409
SimpleDateformat sdf = new SimpleDateformat( "dd MMM yyyy" ) ;

Date d = sdf.parse(rs.getTimeStamp("yourDateColumn")) ;
0
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16872418
(Should of course be "SimpleDateFormat" instead)
                                                ^
                                            capital F
0
 

Author Comment

by:coolgem
ID: 16872566
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
 
LVL 25

Accepted Solution

by:
InteractiveMind earned 250 total points
ID: 16872645
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
 

Author Comment

by:coolgem
ID: 16872855
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
 
LVL 25

Expert Comment

by:InteractiveMind
ID: 16873165
I assume you got it working then?

Thanks for points :)
0
 

Author Comment

by:coolgem
ID: 16873176
You are welcome. You are always a great help. CG
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show, step by step, how to integrate R code into a R Sweave document
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question