Solved

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

Posted on 2006-06-09
10
305 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
factorial example challenge 10 92
splitOdd10 challenge 5 80
VB6 Compile Compatibility Issue 4 89
creating threads in delphi 1 82
I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

910 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

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now