Solved

Getting Date from Database table:  In JAVA

Posted on 2006-07-17
1
267 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
x_bakos earned 100 total points
ID: 17125128
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
BATCH to EXE Converter 2 99
AvlTree-Node Data type 4 47
Do Wend Macro not working 22 73
VB.Net Outlook.ReportItem Body Text convert to Readable Characters 5 38
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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 …
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…

752 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