Solved

Date Format

Posted on 2006-10-27
7
251 Views
Last Modified: 2010-03-31
Hi

I want to display dates in 2 formats

format 1: DATE(MM/DD/RRRR):HR:MM AM/PM
format 2: DATE(MM/DD/RRRR)

How can I get the date format.

Thanks
0
Comment
Question by:basirana
  • 4
  • 2
7 Comments
 

Author Comment

by:basirana
ID: 17822217
The problem is I am pulling Date (information from database. when I want to display I want to display in above formats
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17822223
Use java.text.SimpleDateFormat
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17822230
0
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.

 
LVL 3

Accepted Solution

by:
srivenky earned 500 total points
ID: 17832205
String format = ""; (Specify the format you want, check java api for all the formats)
SimpleDateFormat sdf = new SimpleDateFormat(format);
Date d = new Date(rs.getString("YourDBDateDateField"));
String newDate = sdf.format(d);
0
 

Author Comment

by:basirana
ID: 17833590
Is there any difference in normat dateformate and when we use it with hibernate.
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17859854
What was wrong with my answer ?
0
 
LVL 14

Expert Comment

by:hoomanv
ID: 17868025
http://www.experts-exchange.com/help.jsp#hi68
In case of duplicate or similar comments, you should always select the first comment posted
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

Suggested Solutions

Title # Comments Views Activity
split53 challenge 7 96
micro services vs rest web services 16 104
factorial example 4 39
printf performancy 11 36
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…

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