Solved

Date Format

Posted on 2006-10-27
7
253 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
more than one jdk and one jre 1 50
ejb on wildfly 5 30
Adding multiple JVM environments to RedHat 6 7 48
Running JavaFX on the Raspberry Pi 27 40
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…
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 …
The viewer will learn how to implement Singleton Design Pattern in Java.
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.

861 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