Solved

Getting Date from Database table:  In JAVA

Posted on 2006-07-17
1
262 Views
Last Modified: 2010-05-18
Hello All,

I want to get Date from a DB2 table which is declared as Timestamp.  I want to have date printed in a jsp page in the format Month, Year.
can you please inform me, how can i do this ?
do i have to declare it as Date format or string format and get from the result set?

thanks
0
Comment
Question by:altima4u
1 Comment
 
LVL 3

Accepted Solution

by:
x_bakos earned 100 total points
Comment Utility
Hi,

the way I do it is the followng in JAVA:

String query = "select to_char(ta.date,'DD/MM/YYYY') as the_date "+
                  "from [table] ta "+
                  "where [where_clause]";

Notice that "ta.date" means that you take the column "date" from [table]....

Try to make the above work for your tables....

Hope to have helped

Bakos
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

762 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

12 Experts available now in Live!

Get 1:1 Help Now