Solved

Date Format

Posted on 2006-10-27
7
259 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
[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
  • 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

Independent Software Vendors: 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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

691 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