Solved

Date Format

Posted on 2006-10-27
7
250 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

864 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

25 Experts available now in Live!

Get 1:1 Help Now