Solved

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

Posted on 2006-06-09
10
292 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Problem to setup 18 80
sumDigits  challenge 7 61
Sorting in Excel with Group Headers if the Exist 2 70
wordcount challenge 11 76
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
A short article about problems I had with the new location API and permissions in Marshmallow
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…

760 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

22 Experts available now in Live!

Get 1:1 Help Now